Aslak Hellesøy
2017-08-16 10:42:35

@Aslak Hellesøy has joined the channel

Aslak Hellesøy
2017-08-16 10:42:35

set the channel description: Discuss Cucumber.js

charlierudolph
2017-08-16 10:42:35

@charlierudolph has joined the channel

jbpros
2017-08-16 10:42:35

@jbpros has joined the channel

gmk
2017-08-16 10:43:20

@gmk has joined the channel

gmk
2017-08-16 10:43:27

Hi channel

Aslak Hellesøy
2017-08-16 10:43:53

Hey - so you're trying to build cucumber.js?

gmk
2017-08-16 10:44:41

i justed created a PR for Docs

Aslak Hellesøy
2017-08-16 10:45:25

Oh - we're actually in the process of moving all docs over to this repo: https://github.com/cucumber/docs.cucumber.io

GitHub
Aslak Hellesøy
2017-08-16 10:45:49

As you'll see in that README - docs in other locations will eventually be removed.

gmk
2017-08-16 10:46:11

yeah have seen it

gmk
2017-08-16 10:47:00

do you think that might cause the failure

Aslak Hellesøy
2017-08-16 10:47:44

In the other slack channels you mentioned a build problem for cucumber expressions. Not sure how that is related to the docs.cucumber.io repo?

gmk
2017-08-16 10:47:48

customparametertype_test.js this test is failing

raquelb
2017-08-16 10:48:37

@raquelb has joined the channel

Aslak Hellesøy
2017-08-16 10:50:33

Ah it's a formatting error. I'll fix it. Still puzzled how this is related to you creating a PR for docs.cucumber.io

Gem
2017-08-16 10:52:08

@Gem has joined the channel

gmk
2017-08-16 10:52:40

me to bit confused how come docs cause this error

Gem
2017-08-16 10:53:06

@Aslak Hellesøy Do you happen to have any input on what @tewksbum was trying last night? I was hitting a knowledge wall and then had to hit the hay

tewksbum
2017-08-16 10:53:10

@tewksbum has joined the channel

Gem
2017-08-16 10:53:30

@tewks

tewks
2017-08-16 10:53:32

@tewks has joined the channel

tewks
2017-08-16 12:02:28

thanks @Gem - yeah, any help here apprecited. I

tewks
2017-08-16 12:02:44

‘m still trying to track it down!

Aslak Hellesøy
2017-08-16 12:20:50

@gmk just pushed a fix for that eslint problem (to the cucumber/cucumber repo). If you're working on docs, please do that in the cucumber/docs.cucumber.io repo - the docs folder in cucumber/cucumber is obsolete and will soon be removed.

gmk
2017-08-17 05:27:25

@Aslak Hellesøy : sure will follow it.

diavadai
2017-08-18 08:55:59

@diavadai has joined the channel

James
2017-08-20 02:42:43

@James has joined the channel

gdinwiddie
2017-08-21 10:47:29

@gdinwiddie has joined the channel

Aslak Hellesøy
2017-08-21 13:09:08

has renamed the channel from "cucumber-js" to "help-cucumber-js"

Aslak Hellesøy
2017-08-21 13:09:30

set the channel topic: Get help with Cucumber.js

shashikumarraja
2017-08-25 06:16:03

@shashikumarraja has joined the channel

shashikumarraja
2017-08-25 06:16:43

I am using wdio-cucumber to write my tests . Scenario: login as existing user Given the page url is "http://www.test.com" Then I expect that element "#login-form" becomes visible When I login with email "automate@test.com" and password "1234" Then I expect that element ".user-detail" becomes visible And I expect that the url is "http://www.test.com/user/automation/profile" . I want to pass variables for email and password so that each run of the test takes new value. How can I achieve this

charlierudolph
2017-08-25 10:13:05

I would say environment variables or the world parameters CLI option: https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#world-parameters

GitHub
seb
2017-08-29 01:31:25

@seb has joined the channel

seb
2017-08-29 01:31:30

@charlierudolph - we’re wanting to update JS and Cucumber-JS on Cyber-Dojo.org , but we’re having problems loading modules. I worked on it with @jbpros a few weeks ago, but we didn’t get to a resolution. He suggested you might be able to help.

The issue is to do with global/local installs of Cucumber-JS and the interaction with ‘require’ statements.

gdinwiddie
2017-08-29 05:32:02

Just yesterday I discovered the multiple interfaces that may be used with Cucumber-JS step definitions (https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/step_definitions.md). The asynchronous promise interface seems cleaner than the asynchronous callback interface. Can someone with more experience describe the pros and cons of each? I'd like to make a relatively informed decision before going too far down either path.

GitHub
charlierudolph
2017-08-29 08:12:03

@gdinwiddie I personally prefer promises. To me, promises are the same as callbacks with better protection around them and a more standardized API for success / failure via then / catch. Callbacks have a common pattern of err being the first argument but there are instance where that isn't followed. Promises can also be written really nicely using async / await (which can be converted to es5 using babel).

gdinwiddie
2017-08-29 08:15:53

Thanks. Promises seemed like a much cleaner solution, but I don't have much experience with cucumber-JS yet, or even with modern JavaScript. (And I'm complicating things with Angular and Protractor.)

gdinwiddie
2017-08-29 23:27:20

This isn't precisely about cucumber-js, but can anyone point me to how to dynamically inject a mock Angular service under the control of the scenario? The articles I've found all seem focused on static DI to wire up an Angular app.

vh
2017-09-06 11:16:03

@vh has joined the channel

vh
2017-09-06 11:16:06

Hello friends

vh
2017-09-06 11:17:08

I would like to create reports on Cucumber by using the plugin: multiple-cucumber-html-report and it works just fine.

vh
2017-09-06 11:17:40

However, the issue I'm facing is when trying to generate the JSON file, I'm using Cucumber 3.0.1 and I'm trying to generate a JSON format file

vh
2017-09-06 11:18:20

this the code I'm using to generate the HTML report:

    // Create the HTML report 
    const report = require('multiple-cucumber-html-reporter');
    report.generate({
      jsonDir: './features/reports/',
      reportPath: './features/reports/'
    });
vh
2017-09-06 11:21:28

this is the code I'm using to generate the JSON file:

// Create the results JSON file
    var jsonFormatter = new Cucumber.JsonFormatter();
    jsonFormatter.log = function(report) {
      const jsonReport = JSON.parse(report);

      // Generate a featurename without spaces, we're gonna use it later
      const featureName = jsonReport[0].name.replace(/\s+/g, '_').replace(/\W/g, '').toLowerCase();

      // Here I defined a base path to which the jsons are written to
      const snapshotPath = path.join(projectRoot, './features/reports');

      // Think about a name for the json file. I now added a featurename (each feature
      // will output a file) and a timestamp (if you use multiple browsers each browser 
      // execute each feature file and generate a report)
      const filePath = path.join(snapshotPath, `report.${featureName}.${new Date}.json`);

      // Create the path if it doesn't exists
      fs.ensureDirSync(snapshotPath);

      // Save the json file
      jsonFile.writeFileSync(filePath, jsonReport, {
        spaces: 2
      });
    };
vh
2017-09-06 11:21:54

The code is invoked on the "After" event on the hook.js file

vh
2017-09-06 11:22:49

When running I get this error:

TypeError: Cannot read property 'eventBroadcaster' of undefined at /node_modules/cucumber/lib/formatter/json_formatter.js:55:12 

vh
2017-09-06 11:23:17

on this code line: var jsonFormatter = new Cucumber.JsonFormatter();

vh
2017-09-06 11:24:15

Anybody has any idea how to fix that issue? please

vh
2017-09-06 11:24:50

I'm using the following libraries versions:

 ** ├─┬ cucumber@3.0.1 ** │ ├─┬ cucumber-expressions@4.0.3 ** │ ├── cucumber-tag-expressions@1.0.1
charlierudolph
2017-09-06 13:23:12

The json formatter requires to be passed in an eventBroadcaster. This is something only cucumber can create. An alternative approach would be to use the json formatter via cucumber-js cli and then parse the json file after cucumber-js has finished executing to rename the file as needed

vh
2017-09-06 14:12:02

Actually, that is what I ended doing creating the json file via CLI and I'm about to parse it so it can match the format for the HTML reporter

vh
2017-09-06 14:12:54

However, on Cucumber 3.x I'm not sure where to find samples or anything to do that you just said: "The json formatter requires to be passed in an eventBroadcaster." @charlierudolph

vh
2017-09-06 14:13:07

Is there any documentation out there for that?

vh
2017-09-06 14:23:33

Another thing is that the CLI created the JSON file, however, when trying to parse it, it returns an error: Unexpected end of JSON input

vh
2017-09-06 14:52:30

oh I just discovered that I should generate the HTML report on a different JS file rather than the Hook

vh
2017-09-06 14:52:39

I need for the JSON file to be completed and unloaded

keith
2017-09-15 04:50:13

@keith has joined the channel

yasserf
2017-09-17 03:49:55

@yasserf has joined the channel

yasserf
2017-09-17 03:50:13

hello! I'm trying to find out how to get the older reporting syntax from cucumber2 (javascript) back (dots is awesome, but its pretty hard to know when things go haywire)

Also, if there is a recommended approach for running tests in parallel in JS land that would epic!

raquelb
2017-09-22 06:57:29

Hi! In my team we are trying to generate reports with cucumber-html reporter, but they are facing an error and we don't know how to fix it: ```ERROR: a handler errored, process exiting: cucumber/steps/hooks.js:39: suite.features.forEach is not a function

cucumber-html-reporter v2.0.3 wdio-cucumber-framework v1.0.2 which has cucumber v2.3.1``` Have anyone here seen a similar error and can help?

KariiO
2017-09-23 14:25:44

@KariiO has joined the channel

droyster
2017-09-28 09:10:01

@droyster has joined the channel

droyster
2017-09-28 09:10:15

Cucumber 3.0 JS broke my tests so I reverted. What stopped working for me was my screenshot/ browser log methods. I was keying off of scenario.isFailed()

droyster
2017-09-28 09:10:42

```/*Runs after test Outputs browser logs & Takes screenshot on failure */ After( async function (scenario) { if (scenario.isFailed()) { const world = this; browser.manage().logs().get('browser').then(function(browserLog) { console.log('browser log: ' + require('util').inspect(browserLog)); });

    return browser.takeScreenshot().then(function (screenShot) {
      world.attach(screenShot, 'image/png');
    });}```
droyster
2017-09-28 09:11:00

anybody know what the cucumber 3.0 equivalent to this code block would be?

Aslak Hellesøy
2017-09-28 09:28:38

@droyster there is an issue on github iirc. Maybe @charlierudolph or @jbpros can help?

droyster
2017-09-28 09:29:13

@Aslak Hellesøy can you link me so I can watch it on github?

Aslak Hellesøy
2017-09-28 09:29:40

Sorry you have to search :-)

Aslak Hellesøy
2017-09-28 09:30:32

Too busy atm

droyster
2017-09-28 09:35:33

no problem found it! https://github.com/cucumber/cucumber-js/issues/937

GitHub
👍 Aslak Hellesøy
charlierudolph
2017-09-28 10:04:13

Latest docs on the matter: https://github.com/cucumber/cucumber-js/blob/v3.0.3/docs/support_files/attachments.md

GitHub
samhatoum
2017-10-02 05:53:07

@samhatoum has joined the channel

samhatoum
2017-10-02 06:20:52

Hi there. Is there any way to remove the messages in logs that are between Undefined Step Snippets? I would like to copy/paste multiple step defs into my source file. To illustrate the issue, currently this is the output:

1) Scenario: My Scenario - test/specifications/specification-workspace-for-software-teams/maintain-specifications/test.feature:3
   Step: Given a precondition - test/specifications/specification-workspace-for-software-teams/maintain-specifications/test.feature:4
   Message:
     Undefined. Implement with the following snippet:

       Given('a precondition', function () {
         // Write code here that turns the phrase above into concrete actions
         return 'pending';
       });

2) Scenario: My Scenario - test/specifications/specification-workspace-for-software-teams/maintain-specifications/test.feature:3
   Step: And another precondition - test/specifications/specification-workspace-for-software-teams/maintain-specifications/test.feature:5
   Message:
     Undefined. Implement with the following snippet:

       Given('another precondition', function () {
         // Write code here that turns the phrase above into concrete actions
         return 'pending';
       });

I would like it to be:

       Given('a precondition', function () {
         // Write code here that turns the phrase above into concrete actions
         return 'pending';
       });

       Given('another precondition', function () {
         // Write code here that turns the phrase above into concrete actions
         return 'pending';
       });

Any way to do this?

charlierudolph
2017-10-02 08:40:50

There is a snippets formatter for this purpose: https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#formats

GitHub
samhatoum
2017-10-02 09:38:42

thanks @charlierudolph - I saw that and tried it but I must have done something wrong. Works now 🙂

Aslak Hellesøy
2017-10-05 08:10:54

cucumber-expressions 4.0.4 is out with some bugfixes: https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/CHANGELOG.md#404---2017-10-05

GitHub
KariiO
2017-10-05 12:23:35

Does someone @here using protractor with cucumberjs?

gdinwiddie
2017-10-05 12:34:19

I started a proof of concept with protractor, angular, and cucumberjs. See if https://github.com/gdinwiddie/AngularCucumber helps at all.

GitHub
KariiO
2017-10-05 12:41:16

It's quite similar to that: https://github.com/wswebcreation/protractor-cucumber-typescript-boilerplate

GitHub
KariiO
2017-10-05 12:42:11

@gdinwiddie started a proof ok but do you using this combination in work?

gdinwiddie
2017-10-05 12:44:05

A client is. (This isn't their code, but I did this helping them work out how to do it. I didn't have access to their repository.)

gdinwiddie
2017-10-05 12:45:13

(I got bogged down in the Angular portion after the guy who knew Angular got pulled off for emergency work on another project. Anyone know how to dynamically inject a service using Angular?)

txm
2017-10-10 01:41:17

@txm has joined the channel

txm
2017-10-10 01:41:36

Hi. I'm new to Cucumber(.js) + BDD. Looking at line 32 + 36, there's no callback, and it seems common with other examples. http://cucumber.github.io/cucumber-js/. This is my version and I'm using callbacks https://pastebin.com/Lsk9MVyj. is either method wrong or better or .. ?

gdinwiddie
2017-10-10 06:53:26

*Thread Reply:* @txm "This page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff."

txm
2017-10-10 06:55:53

*Thread Reply:* @gdinwiddie thanks. I'm not 100% sure what it was, I inherited a few samples, I introduced a nice mix of callbacks and Promises. I've set SELENIUMPROMISEMANAGER=0, removed the callbacks and am returning Promises everywhere (without catch) and am trusting them to do their thing and touch wood making good progress.

John Nguyen
2017-10-10 14:51:35

@John Nguyen has joined the channel

randy
2017-10-13 00:58:11

@randy has joined the channel

yasserf
2017-10-13 03:41:48

hey! Any chance someone knows how I can get the test reports to show up in the cucumber 2 format rather than the cucumber 3 dots?

charlierudolph
2017-10-14 10:21:21

cucumber-js removed the pretty formatter in 3.0. Any scenario that doesn't pass, appears as pretty printed thought

Chip
2017-10-18 13:00:10

@Chip has joined the channel

diavadai
2017-10-20 03:02:14

hi, does anyone know where cucumber. js outputs results? we are trying to integrate into jenkins. Thanks guys

Aslak Hellesøy
2017-10-20 03:58:17

@diavadai by default it outputs results to stdout. See cucumber --help for help about different output formats and how to write results to a file.

diavadai
2017-10-20 03:59:37

thanks so much for your help!

diavadai
2017-10-20 03:59:42

have a good weekend

Aslak Hellesøy
2017-10-20 04:52:52

you too!

Yemi
2017-10-25 08:29:47

@Yemi has joined the channel

Yemi
2017-10-25 09:20:18

Hi, Does anyone know why this doesn't work Given(/^I go to "([^"]**)"$/, function(site) { browser.get(site); }); I just get a timeout error and the site doesn't load in the browser

charlierudolph
2017-10-25 09:23:23

Is browser.get synchronouns and do you expect it to complete in less than 5 seconds?

Yemi
2017-10-25 09:28:23

should load in less than 5 seconds, but the browser just opens and then closes, don't even try to navigate to the site

KariiO
2017-10-26 03:54:45

There are advantages or disadvantages of using direct connect to web driver over connecting to selenium server or vice versa?

Victor C
2017-10-26 10:29:26

@Victor C has joined the channel

samhatoum
2017-10-27 22:41:41

@Yemi try:

Given(/^I go to "([^"]**)"$/, async function(site) {
  await browser.get(site);
});

Assuming you're using a promise-based browser like webdriver.io

zac
2017-10-30 05:36:05

@zac has joined the channel

suswari
2017-10-30 07:31:14

@suswari has joined the channel

zac
2017-10-30 08:47:15

anybody here

KariiO
2017-10-30 08:49:57

@zac yeah, just ask someone should answer

zac
2017-10-30 08:50:17

cool beans!! thanks @KariiO

zac
2017-10-30 08:50:52

any one here worked with async/await in Protractor with Cucumber. I am seeing that my Cucumber steps pass without the protractor steps being completed

suswari
2017-10-30 09:59:16

*Thread Reply:* try adding browser.driver.sleep for 1000ms as first step in every stepdefinition and see if you can actually view some execution happening on the screen

zac
2017-10-30 10:11:16

*Thread Reply:* sorry that doesn't help - I tried this already

zac
2017-10-30 08:51:01

wanted to know what may be the cause of this

KariiO
2017-10-30 08:51:34

can you show code? or part of it, at least step definitions

zac
2017-10-30 08:57:30

Well I can't because it's from my company. However I'll try to have a similar set up tomorrow so that I can at least demo it

zac
2017-10-30 08:57:58

I have been searching this for the last week but haven't been able to get any satisfying answer

zac
2017-10-30 08:58:15

due to this I even removed my scenario outlines from the test still they fail

KariiO
2017-10-30 08:59:10

Just pm me tomorrow and I will see if can help

zac
2017-10-30 08:59:23

cool beans!

zac
2017-10-30 08:59:55

There aren't many examples for async/await with Protractor and Cucumber JS and that doesn't help though.

KariiO
2017-10-30 09:00:30

https://github.com/wswebcreation/protractor-cucumber-typescript-boilerplate https://github.com/igniteram/protractor-cucumber-typescript

GitHub
GitHub
zac
2017-10-30 09:01:39

well these are basic scenarios which work for basic tests but when trying to scale up multiple tests, these both have issues. However, the second one is the one on which I have based my framework

zac
2017-10-30 09:01:55

and none of these two contain Scenario Outline examples

KariiO
2017-10-30 09:02:46

I am familiar with second one too

zac
2017-10-30 09:04:08

yeah Ram's framework is a good one and works pretty well but for some reasons my async tests don't wait for the time they should wait for the promise to resolve and they move on to the next step , with the previous step still in progress

zac
2017-10-30 09:04:18

this messes up the tests 😞

KariiO
2017-10-30 09:04:52

are you using async + await or chain + return promises?

zac
2017-10-30 09:05:02

the first one

diavadai
2017-11-03 12:36:57

*Thread Reply:* i am not using proctractor but i had the same issue. What helped was return and chain the promises together.

akki
2017-10-30 20:16:03

@akki has joined the channel

max.boltik
2017-11-07 07:42:35

@max.boltik has joined the channel

max.boltik
2017-11-07 07:42:43

Hi! I'm trying to setup cucumber-js with Appium. I want to create CustomWorld with webdriverio driver. Maybe someone has same issue?

Amit
2017-11-08 07:18:04

@Amit has joined the channel

Chip
2017-11-08 08:30:19

Hi everyone, I’m working on getting some front end coverage around a legacy site before we start working on more back end functionality. The issue I’m having is that most actions perform page reloads to process interactions. I’m using the example from https://github.com/igniteram/protractor-cucumber-typescript, but I’m trying to figure out the best way to wait for the page to finish loading (like document.ready) befor checking for my ‘Then’ conditions.

GitHub
Chip
2017-11-08 08:31:11

Does anyone have any suggestions on how to do this?

KariiO
2017-11-08 09:00:10

Hello @Chip, besides that url is different, something else changes too? Like page title?

Chip
2017-11-08 10:08:53

Not too often, most of what I’m trying to get coverage around is something like: Scenario: Search with results When I enter "foo" into the keyword field And I click the search button Then I expect to see results

Chip
2017-11-08 10:09:35

The problem is that the ‘Then’ check is firing before my back end has finished searching, generating the new page, and returning it.

Chip
2017-11-08 10:11:43

I’ve done some stuff with ExpectedConditions looking for text at the bottom of my page - e.g. copyright text, but it feels a bit fragile

KariiO
2017-11-08 10:32:05

This step is responsible for two things:

KariiO
2017-11-08 10:32:47

wait until some text at bottom page appear and then check results?

Chip
2017-11-08 10:40:34

Basically yes. I could break it out into 2, but one of which would (almost) always be some sort of wait for the page to finish loading.

KariiO
2017-11-08 10:41:47

can you show implementation of this step?

hamdi
2017-11-10 08:00:18

@hamdi has joined the channel

diavadai
2017-11-13 09:44:15

hi, does anyone know how i can specify the output location for screenshots when i use word. attach? thanks

charlierudolph
2017-11-13 12:15:57

When you use the attach passed to the world constructor the contents are available in the JSON and event formatter outputs and do not get output to the filesystem

diavadai
2017-11-13 12:47:53

*Thread Reply:* Thanks

jmdrawneek
2017-11-14 03:59:05

@jmdrawneek has joined the channel

jmdrawneek
2017-11-14 04:01:15

@KariiO Any idea what I'm doing wrong? https://pastebin.com/M9vVEjij

jmdrawneek
2017-11-14 04:09:47

Where does the actual js run? Node or in the browser?

KariiO
2017-11-14 04:13:46

get(text) is promise too

KariiO
2017-11-14 04:14:11

when you chain promises you need to return them

KariiO
2017-11-14 04:14:43

are you familiar with async/await?

jmdrawneek
2017-11-14 04:14:47

Is findElement a promise too?

KariiO
2017-11-14 04:14:51

yes

jmdrawneek
2017-11-14 04:14:51

Yep

jmdrawneek
2017-11-14 04:15:09

I just saw someone mentioning that in the comments

jmdrawneek
2017-11-14 04:15:33

It's a great fit for this sort of thing

KariiO
2017-11-14 04:15:37

driver.wait is promise too 😄

jmdrawneek
2017-11-14 04:16:05

That's why I asked if this stuff runs on node or the browser

jmdrawneek
2017-11-14 04:16:09

Ah!

KariiO
2017-11-14 04:17:45

@KariiO uploaded a file: Untitled

KariiO
2017-11-14 04:17:48

you can try this

jmdrawneek
2017-11-14 04:17:50

Is there anyway to get a more verbose output?

KariiO
2017-11-14 04:18:32

verbose output about errors?

jmdrawneek
2017-11-14 04:18:43

Yea

KariiO
2017-11-14 04:19:48

For me is hard to say but If you will return promises or wait for them(await) it should inform you if certain element was found or not

jmdrawneek
2017-11-14 04:20:00

Console logs don't seem to make it to the stdout

KariiO
2017-11-14 04:20:17

console.log works

KariiO
2017-11-14 04:20:55

you put this console.log(element) into driver.findElement() which wasn't returned

jmdrawneek
2017-11-14 04:21:02

Oh it probably wasn't making it to them though

👍 KariiO
jmdrawneek
2017-11-14 04:21:58

Is it ok to use the arrow function as I'm importing the driver from a module? I've read in various places it's a bad idea

KariiO
2017-11-14 04:22:57

arrow function doesn't pass this so you need to be careful, there are probably other restrictions but I think this is main one

KariiO
2017-11-14 04:23:30

async function() {} will work too

jmdrawneek
2017-11-14 04:23:45

Yea it reassigns this

jmdrawneek
2017-11-14 04:24:02

I just wondered as you'd opted to use it

jmdrawneek
2017-11-14 04:24:16

Thanks for the help anyway, it's much appriciated!

KariiO
2017-11-14 04:24:59

no problem

jmdrawneek
2017-11-14 04:40:30

Hmm something isn't right, it's timing out even when I have until.elementLocated({css: 'body'});

jmdrawneek
2017-11-14 04:41:04

Is there anything I can use to test the state of the page/connection?

jmdrawneek
2017-11-14 04:44:16

Ah it's the get failing

jmdrawneek
2017-11-14 04:53:43

@KariiO I'm getting a timeout even when targetting http://www.google.com with driver.get? Is there anyway to get more information on what's going on?

KariiO
2017-11-14 04:54:32

Did you specify baseUrl?

jmdrawneek
2017-11-14 04:54:43

No?

KariiO
2017-11-14 04:55:11

google.com is loaded?

jmdrawneek
2017-11-14 04:57:48

I thought that's what get does?

KariiO
2017-11-14 04:58:40

exactly

jmdrawneek
2017-11-14 04:59:28
Given('I am on the right page', async function () {
    await driver.get('<http://www.google.com/>');
  });
KariiO
2017-11-14 04:59:54

*Thread Reply:* looks fine

jmdrawneek
2017-11-14 05:00:21

*Thread Reply:* Hmm times out

KariiO
2017-11-14 05:02:13

driver probably doesn't have method get, you need to call it on browser

jmdrawneek
2017-11-14 05:09:12

I'm just using vanilla cucumberJS

jmdrawneek
2017-11-14 05:09:24
  • selenium-webdriver
KariiO
2017-11-14 05:12:05

Apologies I thought you are using Protractor. I didn't dive in selenium-webdriver docs so can't say where problem is 😕

KariiO
2017-11-14 05:14:06

but as far I can see most of methods returns Thenable<T> which is like Promise<T> so should work

jmdrawneek
2017-11-14 05:14:57

Ah ah – selenium-webdriver has a promise manager built in and ''aync/await" breaks it

👍 KariiO
KariiO
2017-11-14 05:15:36

my fault - but at least you will know how to manage with protractor 😄

jmdrawneek
2017-11-14 05:16:01

Was too excited to use async / await finally! 😄

KariiO
2017-11-14 05:16:30

There is also: http://webdriver.io/

webdriver.io
KariiO
2017-11-14 05:16:41

and you will be able to use async/await

jmdrawneek
2017-11-14 05:17:08

That's now turned into webdriverJs which I'm using

jmdrawneek
2017-11-14 05:17:36

Totally forgot it's actually webdriver that I'm using in cucumber.

KariiO
2017-11-14 05:18:11

Personally I don't like chaining promises, it would be difficult in complex implementations.

jmdrawneek
2017-11-14 05:18:14

So cucumber got the bame when it wasn't working as expected 😶

jmdrawneek
2017-11-14 05:18:27

The promise manager sorts that

jmdrawneek
2017-11-14 05:18:37

https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs

GitHub
jmdrawneek
2017-11-14 05:18:51

Or you can disable it and use await / async

jmdrawneek
2017-11-14 05:19:08

Which would make sense if I'm using it for everything else 👍

👍 KariiO
Max
2017-11-21 13:14:34

@Max has joined the channel

Sean Lin
2017-11-22 08:39:09

@Sean Lin has joined the channel

seb
2017-11-23 06:52:04

When a row from a Scenario Outline examples table fails, is there anything in the Cucumber-JS default output that shows which row it failed at. I’m looking at a failing scenario outline and can’t see anything.

Except, of course, the actual assertion that failed.

charlierudolph
2017-11-27 06:38:35

Can you paste an example of the output? It should print the file and line number that goes to the row.

Aslak Hellesøy
2017-11-27 06:38:57

@seb ^^

seb
2017-11-27 07:32:34

Thanks @charlierudolph, now that you point it out, I can see that the line number of the failing example row is output.

tomas.eglinskas
2017-11-27 23:57:50

@tomas.eglinskas has joined the channel

innocentiv
2017-11-29 00:24:36

@innocentiv has joined the channel

matt-SmartBear
2017-11-30 08:51:01

@matt-SmartBear has joined the channel

matt-SmartBear
2017-11-30 08:51:25

@charlierudolph is is possible to get the name of the current profile from within your support code?

charlierudolph
2017-11-30 08:52:02

I don't think that exposed anywhere. Whats the use case?

matt-SmartBear
2017-11-30 09:36:54

It would be quite useful for us to be able to check the profile in support code and then configure a different set of adapters in the app - e.g. a fast profile using an in-memory fake database.

matt-SmartBear
2017-11-30 09:37:14

At the moment we use a set of environment variables to pass that info in, but it’s messy.

charlierudolph
2017-11-30 09:41:35

Could you use the --world-parameters option in the fast profile and then handle it in the world constructor?

matt-SmartBear
2017-11-30 09:42:29

Ooh I didn’t know about that

matt-SmartBear
2017-11-30 09:42:35

yeah probably

sergey
2017-12-05 11:53:44

@sergey has joined the channel

Kostas
2017-12-07 03:07:40

@Kostas has joined the channel

Kostas
2017-12-07 03:07:48

Hi All, I recently updated Cucumber in a project that I am working on and part of the hooks functionality broke. import {defineSupportCode} from 'cucumber'; defineSupportCode(function({Before, After}) { ... After(async function (scenario) { if (scenario.isFailed()) { let data = await driver.takeScreenshot(); ... For the above I am getting the following error: TypeError: scenario.isFailed is not a function Any idea how to fix it? I checked in the doc and stackoverflow but couldn't find something helpful. Many thanks!

👍 SteveH
SteveH
2017-12-14 07:08:19

*Thread Reply:* Sorry, I got the wrong end of the stick.

The new scenario object has a different structure: I had to change this line to read:

  After(function (scenarioResult) {
    if (scenarioResult.result.status !== 'passed') {
...

Or equally, you could write:

    if (scenarioResult.result.status == 'failed') {
...

I worked this out by using console.log(JSON.stringify(scenarioResult)); - YMMV

gcombrinck
2017-12-07 04:10:42

@gcombrinck has joined the channel

charlierudolph
2017-12-07 08:11:06

See updated examples here for checking if a scenario failed in a hook: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md

GitHub
👍 Kostas
Kostas
2017-12-07 08:36:43

Thanks @charlierudolph, that worked.

Aslak Hellesøy
2017-12-07 11:18:14

@charlierudolph I keep seeing people using import {defineSupportCode} from 'cucumber'. Can we deprecate that method and point people towards the more elegant import { Given, When, Then } from 'cucumber'?

👍 charlierudolph
John van der Molen
2017-12-14 00:44:25

@John van der Molen has joined the channel

John van der Molen
2017-12-14 00:44:48

Hi, all! Does anyone have a working example of CucumberJS with Selenium? I find the examples on github in version 3.0 quite complicated.

SteveH
2017-12-14 06:35:19

@SteveH has joined the channel

SteveH
2017-12-14 06:36:48

I'm also seeing this one. It seems that the World object isn't available to the AfterAll hook - which is annoying if you e.g., want to log out at the end of everything...

Kostas Tseronis (https://cucumberbdd.slack.com/team/U8B78K0SZ)
SteveH
2017-12-14 07:12:28

Ok, I think this is a new bug: AfterAll doesn't seem to have any World defined - is that right?

'use strict';
var {defineSupportCode} = require('cucumber');

defineSupportCode(function ({AfterAll}) {
  AfterAll(function () {
    this.website.logOut(); 
  });
});

Results in:

Unhandled rejection VError: an AfterAll hook errored, process exiting: features/support/hooks.js:5: Cannot read property 'website' of null

Where this.website.logOut() is defined in the World object, and used everywhere else. New Bug?

SteveH
2017-12-14 07:16:44

*Thread Reply:* Problem solved: AfterAll runs after all scenarios.

https://github.com/cucumber/cucumber-js/issues/896

GitHub
Aslak Hellesøy
2017-12-14 14:12:10

Yep. Cucumber creates a new World instance for every scenario. Which one would you expect to have access to from AfterAll? The last one? That would seem a little arbitrary/odd to me.

Sam3k
2017-12-18 07:57:19

@Sam3k has joined the channel

Sam3k
2017-12-18 07:57:42

Hi everyone, can someone explain in simple terms, why would one want to use Nightwatch.js with Cucumber.js as opposed to just using Cucumber.js?

techTrooper
2017-12-22 06:18:24

@techTrooper has joined the channel

barbara.cabral
2017-12-28 07:59:30

@barbara.cabral has joined the channel

barbara.cabral
2017-12-28 08:00:01

anyone using protractor with cucumber?

barbara.cabral
2017-12-28 08:00:34

@barbara.cabral uploaded a file: Pasted image at 2017-12-28, 2:00 PM

barbara.cabral
2017-12-28 08:00:53

my protractor can't find the steps inside the step_definitions files in my project

Aslak Hellesøy
2017-12-28 08:02:05

I'm not familiar with protractor @barbara.cabral - have you tried to ask in their forums?

barbara.cabral
2017-12-29 08:57:03

*Thread Reply:* It was the version of the cucumber... the version that worked fine to me was: "cucumber": "~1.3.2", "protractor": "^5.1.1", "protractor-cucumber-framework": "^3.0.0"

Aslak Hellesøy
2017-12-29 12:32:28

*Thread Reply:* @barbara.cabral did you search the GitHub issues for protractor-cucumber-framework to see if anyone else has the same problem?

barbara.cabral
2017-12-28 08:09:21

I'm tried in gitter and waiting for response there

FredrikL
2017-12-29 04:52:38

@FredrikL has joined the channel

FredrikL
2017-12-29 04:53:22

Hello experts! 🙂 Does anyone know how to basically achieve AfterStep hooks for recent cucumber-js , 3.2.0 ? based on this link, https://github.com/cucumber/cucumber-js/issues/891, there is something called setDefinitionFunctionWrapper that should be able to accomplish the wanted behaviour, but I do not understand it. Does anyone has any example that can achieve the same? The use case is rather simple. I want to verify that the web application is not throwing any browser console error during each step.

FredrikL
2018-01-03 05:22:33

No one? is there no wish from anyone to be able to do the above function?

charlierudolph
2018-01-03 09:05:59

setDefinitionFunctionWrapper was implemented for turning generator functions into promises. Thus I don't think it has the configuration you need. Please create an issue and we can look into creating such a more useful wrapper as that I believe is something other frameworks would also find useful

Sam
2018-01-07 14:08:45

@Sam has joined the channel

Drew
2018-01-10 09:32:18

@Drew has joined the channel

Aslak Hellesøy
2018-01-10 09:32:18

@Drew do you use Yarn or NPM?

Aslak Hellesøy
2018-01-10 09:32:39

So: npm uninstall -g cucumber

Aslak Hellesøy
2018-01-10 09:32:55

Followed by npm install --save-dev cucumber

Drew
2018-01-10 09:33:56

Returned.

Aslak Hellesøy
2018-01-10 09:34:31

You don't have a package.json file?

Drew
2018-01-10 09:35:00

Thought so but it appears not

Aslak Hellesøy
2018-01-10 09:35:17

Run npm init firs then

Drew
2018-01-10 09:39:52

That's done, then ran npm install --save-dev cucumber

Aslak Hellesøy
2018-01-10 09:40:04

Ok

Aslak Hellesøy
2018-01-10 09:40:32

So now you should have node_modules/.bin/cucumber.js, which you can point IDEA to

Drew
2018-01-10 09:40:57

confirming now. Thank you!

Aslak Hellesøy
2018-01-10 09:41:14

Works?

Drew
2018-01-10 09:41:29

checking

Drew
2018-01-10 09:45:32

odd, same error.

Drew
2018-01-10 09:47:14

looks like the uninstall didn't take, still shows in /usr/local/...

Aslak Hellesøy
2018-01-10 10:38:48

IDEA won't know that you uninstalled it. You need to tell it where your new installation is.

Aslak Hellesøy
2018-01-10 10:39:16

@Drew should be possible in the settings somewhere

Drew
2018-01-10 11:19:35

yep, I figured it out. Had to edit default config settings for cucumber.java

Drew
2018-01-10 11:19:43

Thank you for the patience, and help!

Simon
2018-01-12 13:28:03

@Simon has joined the channel

Oleg
2018-01-23 08:01:36

@Oleg has joined the channel

Oleg
2018-01-23 08:01:51

Greetings! Updating cucumber from v2.3.0 to 3.2.1 using TypeScript with Cucumber Js broke the console report 😞 The bad thing is that there is nothing related to this on web... at least I couldn't find it

Oleg
2018-01-23 08:02:08

@Oleg shared a file: image.png and commented: don't pay attetion to chrome v63 errors

Oleg
2018-01-23 08:02:36

Does anyone knows what can be the issue?

barbara.cabral
2018-02-19 13:40:47

*Thread Reply:* I'm trying to solve problems with this new version. But without sucess...

stantronic
2018-01-26 03:46:13

@stantronic has joined the channel

Cat
2018-01-29 10:16:23

@Cat has joined the channel

jmdrawneek
2018-01-31 05:07:33

Hey guys, can anyone point me in the direction for documentation on how to use Example: in cucumber-js?

Cat
2018-01-31 06:42:38

*Thread Reply:* https://www.sitepoint.com/bdd-javascript-cucumber-gherkin/ This walkthrough includes the examples syntax

SitePoint
Cat
2018-01-31 06:43:02

*Thread Reply:* The step def is just like passing in any other variable

jmdrawneek
2018-01-31 08:11:21

*Thread Reply:* Ah it's in the steps args

Chris
2018-01-31 05:56:37

@Chris has joined the channel

jmdrawneek
2018-01-31 08:54:05

My tests seem to timeout quite often, is there anything I can do about that?

Cat
2018-01-31 08:55:57

depends on why they’re timing out

Cat
2018-01-31 08:56:21

may want to throw in some waits around the likely culprits. i.e., browser.waitForExist(myElement, 3000);

jmdrawneek
2018-01-31 08:57:24

Sometimes steps dont seem to know they've finished

jmdrawneek
2018-01-31 08:57:46

So It'll login but then time out.

jmdrawneek
2018-01-31 08:58:14

Oh in fact I should probably find a puppeteer channel.

suswari
2018-01-31 12:55:32

Hi Guys, did anyone work with cucumberJs + protractor for an application which is mix of angular and non angular? If so, I need some help with how to integrate transition between angular pages and non with protractor

Heather Harter
2018-02-01 08:48:00

@Heather Harter has joined the channel

Mickey Puri
2018-02-07 13:26:02

@Mickey Puri has joined the channel

Mickey Puri
2018-02-08 05:29:56

Hi, We used cucumber for tests along with Angular 1.x , I've recently moved to a new role, and here we are using React. Is there anything special that needs to be done to set up e2e tests with React and Cucumber?

Cat
2018-02-08 05:54:16

*Thread Reply:* Were you using protractor previously to drive your tests?

Mickey Puri
2018-02-20 04:16:07

*Thread Reply:* Yes

Cat
2018-02-20 05:48:51

*Thread Reply:* You’ll probably want to swap to something react-specific or at least not-protractor. Protractor can be used with non-angular frameworks, but I found it a bit clunky compared to just using something framework-agnostic

Mickey Puri
2018-02-20 07:16:24

*Thread Reply:* I read somewhere that provided you switched off the synchronization, it was ok to use Protractor, and also if we put in the Expected Conditions in the test to "work out" when to start.

Mickey Puri
2018-02-20 07:17:02

*Thread Reply:* I don't know of any react specific for this. What did you use in the end?

Mickey Puri
2018-02-20 07:17:38

*Thread Reply:* BTW thanks 🙂

Cat
2018-02-20 08:08:50

*Thread Reply:* Webdriverio - works across frameworks + mobile and electron apps

Cat
2018-02-20 08:09:08

*Thread Reply:* Automation: the game of “How ~lazy~ efficient can I possibly be?”

Chase
2018-02-14 06:56:50

@Chase has joined the channel

barbara.cabral
2018-02-14 11:43:19

Hi, I'm using cucumberjs with protractor. When I tried to add a hook file to my test, I received this error message:

barbara.cabral
2018-02-14 11:43:42

@barbara.cabral uploaded a file: Pasted image at 2018-02-14, 5:43 PM

barbara.cabral
2018-02-14 11:44:32

anyone did already see this error? I was finding in the internet and it could be the version of node installed. What do you think about it?

charlierudolph
2018-02-14 11:45:18

What node/cucumber version are you using?

barbara.cabral
2018-02-14 11:46:17

I'm using this docker image

adamh
2018-02-15 05:04:46

@adamh has joined the channel

adamh
2018-02-15 06:21:08

hey, running with cucumber version 2.0.0-rc.9 and when i go to view the results in the cucumber jvm reports jenkins plugin the scenarios are all zero's. Been doing some looking around and the problem appears to be that the getCountSummary function in cucumber\distcucumber.js:57227 is looking specifically for `type:'scenario'. However when i look in the result json it is missing. Does anyone know is this still an issue with higher up versions? or is there a fix?

adamh
2018-02-15 06:21:24

@adamh uploaded a file: jvmreportresults.PNG

adamh
2018-02-15 07:20:09

have tried a few version upgrades in the mean time and now using version 2.3.1 which has the getCountSummary function in cucumber\dist\cucumber.js:54139 which counts the`type:'scenario', though this still doesn't work with the jenkins report

adamh
2018-02-15 08:38:32

current output from json results file for scenario

"elements": [
      {
        "keyword": "Scenario",
        "line": 15,
        "name": "Header exists",
        ----- should have a type field here but do not ----
         "type": "scenario",
         --------------------------------------------------
        "tags": [
          {
            "line": 1,
            "name": "@x-browser"
          }
        ]
adamh
2018-02-15 09:17:54

think i have found the version i need https://github.com/cucumber/cucumber-js/pull/893

GitHub
barbara.cabral
2018-02-16 08:04:40

@charlierudolph I've created my own image based in the last versions of the frameworks (versions working together of course). Thanks for the help! 🙂

Garrett.SP
2018-02-20 17:01:58

@Garrett.SP has joined the channel

Oleg
2018-02-27 04:42:01

Hello guys, with upgrade to cucumber 3.2 we are unable to take screenshot after step failure when using ignoreUncaughtExceptions: false. Anyone has any idea how can we implement screenshot functionality on step failure while using settings ignoreUncaughtExceptions: false. ?

charlierudolph
2018-02-27 09:18:31

CucumberJs doesn’t have the option ignoreUncaughtExceptions: false. What tool are you passing that into?

tvdberk
2018-02-28 06:10:26

@tvdberk has joined the channel

KariiO
2018-03-03 05:10:21

@Oleg, this setting belongs to Protractor settings

Chun-Hao Lin
2018-03-04 02:25:08

@Chun-Hao Lin has joined the channel

Waleed Deeba
2018-03-07 06:50:32

@Waleed Deeba has joined the channel

binarymist
2018-03-15 16:30:13

@binarymist has joined the channel

XtraSimplicity
2018-03-21 01:26:16

@XtraSimplicity has joined the channel

Adam Hall
2018-03-21 05:37:01

@Adam Hall has joined the channel

Adam Hall
2018-03-21 05:38:30

Hi, I hope it is okay to post this help request here on Slack, my apologies otherwise.

I have been trying to test IE 11 using Protractor and the Cucumber Test Framework (via Cucumber and protractor-cucumber-framework) on a Windows 10 laptop. So far this hasn't worked despite numerous attempts. Yet when I switch the test framework over to Jasmine it all starts working. We want to use Cucumber for our system test automation program. Full details; including copies of the example project code files; can be seen at: https://stackoverflow.com/questions/49261946/protractor-v5-3-0-protractor-cucumber-framework-v4-2-0-not-working-with-ie11-o

Either way many thanks for looking...

stackoverflow.com
charlierudolph
2018-03-21 10:45:46

cucumber-js has issues with IE 11. See https://github.com/cucumber/cucumber-js/issues/1011. Does it work in other browsers?

GitHub
Adam Hall
2018-03-22 03:25:49

@charlierudolph Hi there, I've just double-checked it by running my trial project in Chrome v65.0.3325.181 and the tests run as expected. I've followed the link inside Issue#1011 and I get the expected error when using IE 11 - that is "'Cucumber' is undefined". I didn't see any hint of when this issue is going to be fixed in the issue.

1) Is there any way to know when this will be fixed? 2) Do you happen to know if this can be fixed by downgrading to an older version? In my case I bet that could involve "Protractor", "CucumberJS", "Protractor-Cucumber-Framework" to compatible older versions and I don't how you would tell which those would be at this point (new to using this particular technology stack).

Thanks for the response, at least I know at last that its not a IE configuration issue, corporate security lock down problem, etc. on my test system.

dmshamonov
2018-03-22 05:26:00

@dmshamonov has joined the channel

dmshamonov
2018-03-22 05:31:59

Hi all! Can you help me? How I can run **.steps.js in es6 mode? I have that error:

SyntaxError: Unexpected token import
dmshamonov
2018-03-22 05:33:31

I have babel packages and .babelrc config

charlierudolph
2018-03-22 07:53:13

and https://babeljs.io/docs/usage/babel-register/

babeljs.io
Tifanny
2018-03-22 08:54:04

@Tifanny has joined the channel

dmshamonov
2018-03-22 21:11:25

I found my mistake, thanks!

Charles Rudolph (https://cucumberbdd.slack.com/team/U5B94F1RC)
ahmedh
2018-03-25 03:30:27

@ahmedh has joined the channel

sknight
2018-03-27 05:13:41

@sknight has joined the channel

Brian Blosser
2018-03-27 06:53:01

@Brian Blosser has joined the channel

Brian Blosser
2018-03-27 06:55:58

Hi folks, I'm trying to set up cucumber.js to work with selenium webdriver. I was thinking of building my "driver" in the BeforeAll hook, but for some reason, the "this" in the BeforeAll hook is the Node global "this", and not the Cucumber World. So what I ended up doing was initializing the driver in my CustomWorld constructor. Is this the best practice? Uploading my steps.js file below.

Brian Blosser
2018-03-27 06:56:16

@Brian Blosser uploaded a file: steps.js

Brian Blosser
2018-03-27 06:59:35

In addition, if all my Scenarios for a given feature occur at the same page url, where do I call drive.get(url), if not in BeforeAll? Do I call it in the first scenario, and have the Given state for the first scenario carry over into subsequent scenarios? Thanks!

charlierudolph
2018-03-27 09:16:55

See here for docs on BeforeAll / AfterAll and why this is not a world instance: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md#beforeall--afterall. If you want to share something like a browser between all scenarios, you need to handle that yourself. Cucumber does not have specific support for that because it wants to encourage users to keep scenarios independent so they cannot effect each other. If all scenarios in a feature have some shared precondition use a Background block in your gherkin.

GitHub
Brian Blosser
2018-03-27 11:34:37

Thanks @charlierudolph, it seems like a Background block is the way to go!

Michael Stelly
2018-03-29 10:54:57

@Michael Stelly has joined the channel

Michael Stelly
2018-03-29 10:59:19

hi all. brain hurts. craving 🥒 . need help. I posted my questions in #help before I knew of this channel. If someone could kindly take a peek and see if they can assist me, I would greatly appreciate it.

Michael Stelly
2018-03-29 11:24:19

well, seems my stumbling block has been not knowing about helper functions. at least in part.

Ed Snodgrass
2018-03-29 13:54:56

@Ed Snodgrass has joined the channel

Idayat
2018-03-29 15:47:01

@Idayat has joined the channel

Michael Stelly
2018-03-30 19:39:32

I may be stumbling down the wrong rabbit hole bc I’m getting nowhere. I want to do two things: >1. figure out how to use helper methods for my steps, and >2. mock up a user login to pass into a step definition for creating an account. I can’t seem to get either correct. I created a gist in case someone wants to investigate. Help is always appreciated. https://gist.github.com/mjstelly/e4d6dee11b4ea9205ca512fcaa8e8c49

Michael Stelly
2018-03-30 19:40:18

@Michael Stelly shared a file: accountCreate.feature

Michael Stelly
2018-03-30 19:40:18

@Michael Stelly shared a file: accountCreate.steps.js

Michael Stelly
2018-03-30 19:40:18

@Michael Stelly shared a file: helpers.js

XtraSimplicity
2018-03-30 19:57:33

Do you need to export your helper object?

XtraSimplicity
2018-03-30 20:01:50

(I.e. The helpers variable.)

Michael Stelly
2018-03-31 07:06:09

That could be it. Still learning how to use the Revealing JS pattern

Michael Stelly
2018-03-31 07:42:08

From what I'm reading, the Revealing pattern does not need to be exported. It is a self-invoking function, so importing it into the calling module "reveals" the public API identified in the object returned from the called module. That's how I understand it. If someone has a better understanding, please advise.

Michael Stelly
2018-03-31 07:44:16

And my thought is that I should be able to destructure it like the react module. But I'm new to the ES6/ES7 way of doing things.

Michael Stelly
2018-04-01 09:15:18

I was wrong. I do need to export it. Got my hands on some production examples. Still can't get it to work. I've updated the gist with what my new code. See if anyone can help with that. https://gist.github.com/mjstelly/e4d6dee11b4ea9205ca512fcaa8e8c49

Michael Stelly
2018-04-01 09:15:24

@Michael Stelly shared a file: accountCreate.feature

Michael Stelly
2018-04-01 09:15:25

@Michael Stelly shared a file: accountCreate.steps.js

Michael Stelly
2018-04-01 09:15:25

@Michael Stelly shared a file: helpers.js

Michael Stelly
2018-04-01 09:16:44

Console output:

Michael Stelly
2018-04-01 09:16:48

yarn run v1.5.1 $ cucumber-js F-

Failures:

1) Scenario: Create a new user # features/accountCreate.feature:5 ✖️ When I create a new member # features/stepdefinitions/accountCreate.steps.js:5 TypeError: setCreds is not a function at World.<anonymous> (/Users/michaelstelly/Documents/projects/mobilegtm/features/step_definitions/accou ntCreate.steps.js:7:3)

  • Then the user is created successfully # features/step_definitions/accountCreate.steps.js:12

1 scenario (1 failed) 2 steps (1 failed, 1 skipped) 0m00.001s

Michael Stelly
2018-04-01 11:16:23

It's weird. If I keep the function within my step module, the tests pass.

Michael Stelly
2018-04-02 06:06:27

can someone provide an example of using the Revealing Module pattern for ES7? I can't get it to work. My helpers.js snippet is an example of what I've tried so far.

Michael Stelly
2018-04-02 06:15:59

I think this might be the answer. Gonna give it a go. https://stackoverflow.com/a/44373830/226118

stackoverflow.com
Michael Stelly
2018-04-02 06:33:14

Hmm, that didn't end well. I have function login(); export { login }; in my helper. I then import (or so I think) into my step file as const { login } = require('../support/helpers'); When I run cucumber, I get the error

$ cucumber-js ../features/support/helpers.js:12 export { login }; ^^^^^^ SyntaxError: Unexpected token export

Michael Stelly
2018-04-02 06:34:58

Any thoughts on why export is "unexpected"?

Michael Stelly
2018-04-02 07:11:31

Ahh, someone suggested that cucumber may not yet support ES6/7 import/export. Is this the case?

Michael Stelly
2018-04-02 07:29:24

Ok. Found the solutions. Needed to install babel-register and add to the cucumber.js file, module.exports = { default: --require-module babel-register --format-options '{"snippetInterface": "synchronous"}',};

charlierudolph
2018-04-02 10:23:44

import / export are not currently supported by node and thus for cucumber to support them, it would need to transpile the support code. We leave it to the user to define what transpilers to use. https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#transpilers

GitHub
Michael Stelly
2018-04-03 06:17:50

*Thread Reply:* Got it. Thanks

Michael Stelly
2018-04-05 08:34:40

how do i implement Background? In my feature file, I have Background: Given I am a registered user. When I run cucumber, I get

1) Scenario: Log into the app # features/login.feature:8
   ✖ Given I am a registered user
       Multiple step definitions match:
         I am a registered user - features/step_definitions/loginUser.steps.js:14
         I am a registered user - features/step_definitions/loginUser.steps.js:41
         I am a registered user - features/step_definitions/loginUser.steps.js:63
         I am a registered user - features/step_definitions/loginUser.steps.js:90
         I am a registered user - features/step_definitions/loginUser.steps.js:117
Michael Stelly
2018-04-05 08:58:47

And any associated steps report as Ambiguous

5 scenarios (5 ambiguous)
23 steps (9 ambiguous, 14 skipped)
0m00.000s
Chase
2018-04-05 09:04:02

your background step looks good, the issue is that you have defined multiple step definitions that match "I am a registered user"

Michael Stelly
2018-04-05 09:12:51

Isn't that the point of having a background step?

Chase
2018-04-05 09:14:15

can you post your loginUser.steps.js?

Chase
2018-04-05 09:14:42

you only want to define a step one time, but you can use it in multiple scenarios/backgrounds however many times

Michael Stelly
2018-04-05 09:15:20

i understand that. i'll post a gist w/ both files

Michael Stelly
2018-04-05 09:19:06

@Michael Stelly shared a file: loginUser.feature

Michael Stelly
2018-04-05 09:19:07

@Michael Stelly shared a file: loginUser.steps.js

Michael Stelly
2018-04-05 09:22:16

Is this an issue because some scenarios don't have a Given step?

Chase
2018-04-05 09:23:02

No, a scenario could be written entirely with And it's just a helper to make it read more naturally

Chase
2018-04-05 09:25:11

What I meant about having defined the step multiple this is this, you have the same step defined inside loginUser.steps.js on line 14, 41, 63, 90, and 117

Chase
2018-04-05 09:25:29

you only need to have Given('I am a registered user', function() { // Write code here that turns the phrase above into concrete actions return 'pending'; }); written once in the steps file

Chase
2018-04-05 09:27:48

some of your other steps are defined multiple times as well, such as When('I press Remember Me', function() {

Michael Stelly
2018-04-05 09:27:52

oh, ok. that was the generated template. i see now. thanks. this is all new to me. so i'll probably make more of these mistakes. appreciate it.

Michael Stelly
2018-04-05 09:29:13

So how would I write a toggle-type scenario?

Chase
2018-04-05 09:29:20

Yea, for some reason the JS version of cucumber will give the same sample snippet multiple times in a run if it is used multiple times. Other languages I've used Cucumber with condense it down to one set

Michael Stelly
2018-04-05 09:42:51

Maybe I don't understand how steps are supposed to work. I have different scenarios that lead to the same place. How do I represent them? For example, submitting email/pw or connect with FB both lead to display the home page. So both contain Then('displays the home page', function(){ blah });. Cucumber reports it as ambiguous. But if I remove one of them and then, later, someone else reads the script, they might wonder why that step is missing. Does that make sense?

👍 dmshamonov
Michael Stelly
2018-04-05 09:44:30

same goes for a toggle button. Both steps would include When('I press Remember Me', function() { blah });

dmshamonov
2018-04-05 23:53:45

What if I have same Background in different Feature steps? cucumber-js will show warnings about it. What is the best practice with this situation?

dmshamonov
2018-04-05 23:58:16

Why if I run one feature cucumber-js features/sign-up/sign-up.feature are all Before hooks executing?

1) Scenario: Tenant admin is registered # features/sign-up/sign-up.feature:10
   ✔ Before # features/sign-in/sign-in.steps.js:4
   ✔ Before # features/sign-up/sign-up.steps.js:4
Michael Stelly
2018-04-06 07:08:59

<- not an expert, but from what I read, background is limited to the scope of that feature. If you want behavior for multiple features, it needs to be a hook, or maybe a helper method.

Michael Stelly
2018-04-06 07:09:18

@dmshamonov

DavidTran
2018-04-06 10:55:04

@DavidTran has joined the channel

DavidTran
2018-04-06 12:53:21

There is not a lot of info out there on setting up cucumberjs. Anyone have a good resource and or info?

Michael Stelly
2018-04-06 13:00:49

@DavidTran there's not much to set up, really. Are you having a specific problem?

Michael Stelly
2018-04-06 13:03:48

install with npm or yarn. then in my package.json, I add "scripts": { "cucumber": "cucumber-js", } and in the project root, I run yarn cucumber

Michael Stelly
2018-04-06 13:05:05

here's the github doc https://github.com/cucumber/cucumber-js

GitHub
DavidTran
2018-04-06 13:06:39

May have to start from scratch. Been looking at some of the boilerplate implementations and running into issues. Most likely will use cucumber-js and webdriverio, since I have React and Angular apps.

Michael Stelly
2018-04-06 13:08:54

so, uninstall cucumber, and reinstall. yarn yarn add cucumber --dev for npm, it's npm -i --savedev cucumber, I think. I don't use npm anymore.

celeste.senoseain
2018-04-09 12:45:42

@celeste.senoseain has joined the channel

Michael Stelly
2018-04-16 15:10:30

If cucumber is a documentation tool and NOT a testing tool, then whoever is maintaining the cucumber-js github repo is confused. The first sentence in the README states >Cucumber is a tool for running automated tests written in plain language.

Gem
2018-04-16 15:20:21

Perhaps the author of that wasn't confused but the definition of what Cucumber is has been refined since that was originally written? ¯_(ツ)_/¯

Gem
2018-04-16 15:24:32

@charlierudolph committed that line April 14, 2016 - https://github.com/cucumber/cucumber-js/commit/cd68105df2fa3853362b6000c9dad7511d3b7aa4

GitHub
Gem
2018-04-16 15:24:57

Could certainly be worth considering it for revision

Michael Stelly
2018-04-16 16:30:15

🤷

charlierudolph
2018-04-17 06:04:02

The commit linked is authored by Julien. I’m happy to update it. Any proposed revisions?

Gem
2018-04-17 08:27:48

Sorry @charlierudolph I see that git shows both of you! 😛

Michael Stelly
2018-04-17 16:02:02

I’m still trying to wrap my head around what appears to be a confusion by the general populace of what exactly cucumber is and is not. Is it a collaboration tool, or an acceptance test-driven development tool, or an automated test runner, or something else? Even Wikipedia promulgates the confusion >>>Cucumber is a software tool used by computer programmers for testing other software.[7] It runs automated acceptance tests written in a behavior-driven development (BDD) style.

Michael Stelly
2018-04-17 16:02:38

pulls-out-the-few-remaining-hairs-on-his-head

Gem
2018-04-17 16:05:40

@Michael Stelly It's all of them.

💯 Cat
Cat
2018-04-17 16:10:11

Sometimes - especially when communicating with folks outside of development - it helps when I also explain what Cucumber isn’t. For example: It’s not an assertion framework. It’s not a browser driver.

👍 Gem
Michael Stelly
2018-04-17 16:10:33

@Gem and a dessert topping as well. mmm!

😛 Gem
Michael Stelly
2018-04-17 16:12:32

Oh, and apparently it’s a fruit, as well.

Michael Stelly
2018-04-17 16:12:46

no wonder i’m confused

Cat
2018-04-17 16:14:05

Ok - try reframing it. What question - specifically - are you trying to answer? Beyond “What is Cucumber?” Is it “What business value does Cucumber deliver?” or “What purpose does Cucumber serve in an automation stack?” Or “How can Cucumber help us produce the right features at the right time?” etc.

Michael Stelly
2018-04-17 16:17:28

No, those business questions are readily answered, which is a plus. I’m trying to understand how and where do I put my tests. Although I’m not expert at writing feature files, they’re the easier part.

Michael Stelly
2018-04-17 16:19:19

and since i’ve never written tests before, I’m trying to learn how to put my Jest tests into my steps files.

Cat
2018-04-17 16:20:31

Technically speaking, you’d probably want to abstract out the Jest bits from the step defs

Michael Stelly
2018-04-18 07:41:02

*Thread Reply:* so, are you saying put assertions and tests in a helper file?

Cat
2018-04-18 07:57:14

*Thread Reply:* yup. a good example of this is the cucumber-wdio boilerplate (I know you’re using jest, but seeing how they’ve constructed the helpers may be useful for you) https://github.com/webdriverio/cucumber-boilerplate Note that this looks like its builds are failing (I suspect since wdio-cucumber-framework was only recently updated to 2.1), so just use it as POC for grokking the concept for now 🙂

GitHub
Cat
2018-04-18 07:58:01

*Thread Reply:* specifically: check out src/support underlying directories

Cat
2018-04-18 07:58:20

*Thread Reply:* and look at how they’re implemented in src/steps -> src/features

Michael Stelly
2018-04-18 08:31:29

*Thread Reply:* thanks. i will

Michael Stelly
2018-04-18 08:41:32

*Thread Reply:* After a quick look at the readme, I again bump into point of confusion. It’s steps have very implementation-specific definitions like Given the checkbox "([^"]**)?" is( not)** checked.... I’ve been informed that this is an anti-pattern and should be avoided in these files. What is your experience with this?

Cat
2018-04-18 10:21:39

*Thread Reply:* I think it really depends on the specific thing you’re testing. If you have a UI toggle and you need to test what happens if toggled on vs. toggled off, it’s not a bad way to go - because then it’s not so much implementation specific as expressing specific conditions that need to be met prior to performing an action + expected outcome

Cat
2018-04-18 10:22:44

*Thread Reply:* I also think it depends on how many different elements you have that would have completely different selectors but very similar descriptions (like you have 75 different checkboxes that all have totally different selectors and no common classes or anything)

Cat
2018-04-18 10:22:56

*Thread Reply:* (fyi: that would be a sign that your devs are monsters)

Michael Stelly
2018-04-18 10:38:58

*Thread Reply:* thanks again for the input. as long as you're willing to help, i'll be pinging you for it. 😆 At least until the fog clears. I stare at my step-def files and go "now what?" 🤷

Cat
2018-04-18 10:43:49

*Thread Reply:* 😄

Michael Stelly
2018-04-17 16:24:05

and that would make sense. so you can see why i get confused. trying to learn cucumber from one side, and Jest on the other, and assertions in the middle, it’s a big jumbled mess right now.

Cat
2018-04-17 16:24:39

It’s definitely a trial-by-fire process 😉

☝️ Gem
Michael Stelly
2018-04-19 06:39:02

I need some help thinking through this scenario:Scenario: Select health goals Given Sara wants to select her health goals When zero or more health goals are selected Then the health goals are added to her account information The UI will display a 3x2 grid of buttons that become highlighted when selected. When the user presses Next, the selected items will be passed to a data array and added to the user mobx store. My question is: how do I represent the action of selecting these goal buttons in my step definition file?

Gem
2018-04-19 09:23:00

@Michael Stelly What exactly is the concrete action/setup behind Given Sara wants to select her health goals ?

Gem
2018-04-19 09:24:43

From reading that, it looks like there's the option to not select any goals?

Michael Stelly
2018-04-19 10:19:17

@Gem the action is to select buttons that represent certain health goals that will be added to the user profile. But it’s not mandatory to select them at this time. User can edit their profile later.

Michael Stelly
2018-04-19 10:19:42

That’s why it’s zero or more

Gem
2018-04-19 10:20:15

The given doesn't describe that, it just states that she wants to. 😛

Michael Stelly
2018-04-19 10:20:37

Isn’t that all it’s supposed to do?

Gem
2018-04-19 10:21:26

That doesn't describe a particular concrete state or setup.

Michael Stelly
2018-04-19 10:22:14

Given is the state, not the action. I don’t understand

Gem
2018-04-19 10:22:34

True, sorry, let me edit.

Gem
2018-04-19 10:23:38

Are you equating her wanting to select health goals as a way to ensure the system is on the correct page?

Michael Stelly
2018-04-19 10:25:03

yes, this is where I get conflicted. one person says “don’t discuss implementation in steps”, another says “be more concrete”? ¯_(ツ)_/¯

Gem
2018-04-19 10:25:31

There's a balance that needs to be found and that just takes practice. 🙂

Michael Stelly
2018-04-19 10:26:03

Guess I’ll use the force

Gem
2018-04-19 10:26:41

Sara could be on walmart.com and still want to select her health goals.

Gem
2018-04-19 10:28:05

Where in the app are health goals selected?

Michael Stelly
2018-04-19 10:28:26

Ok, waiting for you to espouse the “frogs on a log” parable…:waiting:

Michael Stelly
2018-04-19 10:29:16

This is the new user signup process. first they enter their info, then select their goals

Gem
2018-04-19 10:37:59

@Michael Stelly What're your thoughts on this?

Feature: Health goals can be added to an account's information during sign-up.
  Rule: Health goals selected must get added to an account's information
  Rule: Health goals are not required to be selected

Scenario: Health goals get selected
  Given Sara is on the health goal selection signup step
  When Sara selects two health goals
  Then the selected health goals should be found in her account information

Scenario: No health goals get selected
  Given Sara is on the health goal selection signup step
  When Sara selects no health goals are selected
  Then no health goals should be found in her account information
Gem
2018-04-19 10:38:16

It's still got some room to be more concrete, but that's what I've whipped up

Michael Stelly
2018-04-19 10:47:35

What is the rule keyword? I’m not familiar with that

Gem
2018-04-19 10:53:21

It's nothing other than indicating what it is. (at least currently)

Gem
2018-04-19 10:54:00

Just trying to keep example mapping in mind and illustrate that's what I came up with.

Gem
2018-04-19 10:54:51

Underneath feature titles you can add whatever data you'd like to help explain things. Commonly you'll see the 'as a xyz, I want to foo, so that bar' entry in that area

Michael Stelly
2018-04-19 18:21:18

yea, that's what I have in mine.

Michael Stelly
2018-04-19 18:22:40

I'll try out that feature. Thanks for the input

Michael Stelly
2018-04-19 18:46:53

Rule isn't supported in cucumber-js

Michael Stelly
2018-04-19 18:48:44

Console error:Error: Parse error in 'features/addHealthGoals.feature': (3:3): expected: #EOF, # Comment, #BackgroundLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Empty, got 'Rule: Health goals selected must get added to an account's information'

Gem
2018-04-19 19:23:55

@Michael Stelly Take out the colon and see if that helps. 😛

Michael Stelly
2018-04-21 06:44:48

*Thread Reply:* I didn't check. I just replaced it and moved on.

Michael Stelly
2018-04-19 19:40:12

Ill check tomorrow and let you know. 👍

Michael Stelly
2018-04-21 07:01:04

Anyone here using Jest? I’m trying to learn how to incorporate jest tests with my steps definition files.

stantronic
2018-04-23 01:05:25

*Thread Reply:* Yes - just starting out trying to get Jest to work with cucumber - using Jest-cucumber. Working good so far

stantronic
2018-04-23 01:05:56

*Thread Reply:* https://www.npmjs.com/package/jest-cucumber

npm
Michael Stelly
2018-04-23 07:16:35

*Thread Reply:* that's what i'm using as well. Learning multiple tools at once is quite harrowing. Like swimming through quicksand.

Michael Stelly
2018-04-23 07:46:45

*Thread Reply:* Oh, this is gonna be rough. I'm getting syntax errors that have totally unhelpful message. 🤦‍♂️

arjunjh10
2018-04-22 18:12:35

@arjunjh10 has joined the channel

arjunjh10
2018-04-22 18:13:16

Hey everyone Been looking to Upgrade cucumber from 2.x to 4.x. We use Typescript for our project Are there any examples for getting Feature names that I can refer.. I am unable to understand how to use the interface events.FeaturesPayload that returns me the getFeatures() that should contain the info i required. Any help would be great. Thanks

dmshamonov
2018-04-23 03:13:42

World is unique between features or save its state? I want save some data in this.data in one Feature and get them in another Feature.

Michael Stelly
2018-04-23 06:29:02

@dmshamonov Read about world here https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/world.md

GitHub
sunil s
2018-04-23 06:44:52

@sunil s has joined the channel

sunil s
2018-04-23 06:49:32

hello everyone,

sunil s
2018-04-23 06:50:14

Can anyone help me to know how to execute multiple feature files using tags in a particular sequence in cucumber js

Michael Stelly
2018-04-23 06:58:35

@sunil s from my understanding, having sequential dependencies is not a good idea (anti-pattern). @Gem may be able to clarify further.

💯 Cat
Manoj
2018-04-23 07:05:07

@Manoj has joined the channel

Michael Stelly
2018-04-23 07:49:04

If someone is learned about jest-cucumber, I could use help deciphering this arcane error message ```$ jest FAIL features/accountCreate.feature ● Test suite failed to run

/Users/michaelstelly/Documents/projects/mobile_gtm/features/accountCreate.feature:1
({"Object.&lt;anonymous&gt;":function(module,exports,require,__dirname,__filename,global,jest){Feature: Create a new member account
                                                                                                         ^
SyntaxError: Unexpected identifier

  at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316

:17)``` What is unexpected about the feature: >>>Feature: Create a new member account As a nonmember Sara wants to create a user account

charlierudolph
2018-04-23 09:19:24

*Thread Reply:* I think that error comes from trying to parse a .feature file as a .js file. Can you check your configuration for what files are being loaded as if they were javascript?

Michael Stelly
2018-04-23 09:22:39

*Thread Reply:* I'll check and let you know. thx

Michael Stelly
2018-04-23 09:28:23

*Thread Reply:* My testMatch mirrors the recommended config "testMatch": ["****/**.steps.js", "****/**.feature"]

charlierudolph
2018-04-23 09:49:25

*Thread Reply:* I don’t know the jest config. I would look for support on the jest side (wherever the cucumber plugin lives)

Gem
2018-04-23 08:51:00

@Michael Stelly You got it WRT to dependencies. @sunil s Every scenario you write should be atomic from one another (aka, able to be run on their own)

arjunjh10
2018-04-23 12:00:01

My message had no takers 😞

Arjun Jhawar (https://cucumberbdd.slack.com/team/U6H473WRL)
charlierudolph
2018-04-23 17:17:12

*Thread Reply:* the internal hooks changed a lot in 3.0. What is your use case for needing the feature names?

arjunjh10
2018-04-23 17:31:14

*Thread Reply:* Thanks for the response Charlie, I run Ui tests through the framework and use browserstack as my remote server.

The framework previously would allow me to get feature names at the start so that when I run tests in parallel using node processes , I could easily mark each feature by the Browser it is run on and post to Browserstack.

That way I name my browserstack session runs which are per feature in my case. Now I know you’d say its not ideal, but it was a conscious decision to run each feature file on a single selenium session and update app state per scenario so that the scenarios were still independent of each other.

charlierudolph
2018-04-23 18:55:39

*Thread Reply:* That’s not possible anymore. The closest thing you can get is the parameter passed to a before hook. See the api reference doc for more info

arjunjh10
2018-04-23 19:01:58

*Thread Reply:* Ok.. Thanks Charlie

dmshamonov
2018-04-23 16:34:33

I read this but not found answer for my question. I decided what World saves its state only in one Feature context.

Michael Stelly (https://cucumberbdd.slack.com/team/U9Y6833CJ)
Michael Stelly
2018-04-23 17:13:17

@dmshamonov state is generated separately for each feature. you might be able to use a state manager like redux or mobx to store data, then call it in each set of tests.

dmshamonov
2018-04-23 17:15:44

Use state manager in tests? This is good practice?

Michael Stelly
2018-04-23 19:37:58

*Thread Reply:* Not sure. I’m throwing out ideas here. But if you want to set the environment for each feature, you’ll have to generate some kind of state.

Michael Stelly
2018-04-23 19:38:47

*Thread Reply:* I’ll defer to others that have more experience with this. Also, try the regular #help channel. That may get the answer you need.

dmshamonov
2018-04-23 21:50:14

*Thread Reply:* Ok, thanks

Michael Stelly
2018-04-24 06:15:04

*Thread Reply:* I recommend asking @Gem or @Cat

Ed Snodgrass
2018-04-26 06:49:12

*Thread Reply:* @dmshamonov Have you tried using hooks w/ tags to solve your problem? https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md

GitHub
Ed Snodgrass
2018-04-26 06:51:07

*Thread Reply:* You can do a 'Before' to set the state you desire before any scenarios are ran from within a tagged feature. Otherwise I believe the world object is replaced with each scenario (because no scenario should rely on a previous scenario)

dmshamonov
2018-04-26 19:27:06

*Thread Reply:* Yes, I understand. Thanks

dmshamonov
2018-04-27 02:25:44

*Thread Reply:* @Ed Snodgrass Ok... In hook "Before" or "Background" I init some data for "Scenarios". Example I create some entity there and save IDs in "World". And I need to delete those entity in end. But in "After" hook "World" isn't available...

Ed Snodgrass
2018-04-30 06:36:14

*Thread Reply:* @dmshamonov, When I set a value on world, i can print out its contents in the after hook.

//steps file
const { Given, After } = require('cucumber');

After({ tags: '@LogWorldAfterScenario' }, function() {
  console.log(this.value);
});

Given(/^I have set a value on the world$/, function() {
  this.value = 'Hello World';
});
#feature file
@LogWorldAfterScenario
Feature: After Hook should have the world object

  Scenario: Test After Hook
    Given I have set a value on the world
dmshamonov
2018-04-30 06:55:05

*Thread Reply:* @Ed Snodgrass I mean AfterAll hook, sorry...

Ed Snodgrass
2018-04-30 06:57:43

*Thread Reply:* if the values are set on the world aren't they being cleaned up after each scenario runs?

Javi
2018-04-25 07:10:17

@Javi has joined the channel

iiicubed
2018-04-25 07:45:20

@iiicubed has joined the channel

iiicubed
2018-04-25 07:46:18

howdy all! i am trying to run Cucumber tests in parallel on a Selenium Grid, but i’m getting the following error:

undefined:1

SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at Master.parseSlaveLine (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber/lib/runtime/parallel/master.js:70:24) at Interface.<anonymous> (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber/lib/runtime/parallel/master.js:102:15) at emitOne (events.js:115:13) at Interface.emit (events.js:210:7) at Interface.onLine (readline.js:278:10) at Interface.normalWrite (readline.js:420:12) at Socket.ondata (readline.js:138:10) at emitOne (events.js:115:13) at Socket.emit (events.js:210:7) at addChunk (streamreadable.js:252:12) at readableAddChunk (streamreadable.js:239:11) at Socket.Readable.push (streamreadable.js:197:10) at Pipe.onread (net.js:589:20) Unable to parse cucumberjs output into json: ‘test/automation/reports/cucumber-json-report.json’ SyntaxError: test/automation/reports/cucumber-json-report.json: Unexpected end of JSON input at JSON.parse (<anonymous>) at Object.readFileSync (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber-html-reporter/nodemodules/jsonfile/index.js:69:17) at isValidJsonFile (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber-html-reporter/lib/reporter.js:416:48) at Object.generate (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber-html-reporter/lib/reporter.js:438:9) at Object.generateReport [as generate] (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber-html-reporter/index.js:30:21) at Object.<anonymous> (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/@pps/testing/htmlReporter.js:11:10) at Module.compile (module.js:569:30) at Object.Module.extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12)

Michael Stelly
2018-04-25 07:51:44

anyone have experience using cucumber with jest? if so, need some config and basic usage help. 👍

iiicubed
2018-04-25 07:57:58

fyi, figured out my issue — console.log()!! https://github.com/cucumber/cucumber-js/blob/58caad38be582490ebb1ad4c8e9fe01b2732ace4/docs/cli.md#parallel-experimental

Note: Printing to stdout (using console.log or other means) will cause an error, because the slave processes communicate with the master process over stdout. Instead print to stderr (using console.error or other means).

GitHub
iiicubed
2018-04-25 07:58:13

moral of the story? RTFM

Michael Stelly
2018-04-25 08:24:38

console.log(FTW);

Michael Stelly
2018-04-25 08:27:19

fyi, what I've done for log cleanup is define a boolean doLog flag, then add doLog &amp;&amp; console.log(); in my code. when I want to switch it off, just set doLog = false; Problem solved.

👍 iiicubed
Michael Stelly
2018-04-25 08:28:21

saves a lot of grief over random log statements throughout the code base.

iiicubed
2018-04-25 08:49:51

i’ll be doing something similar.

iiicubed
2018-04-25 10:49:41

here’s another one pickle brains:

iiicubed
2018-04-25 10:50:39

running --parallel against a Selenium Grid, i am getting Cannot read property ‘attachments’ of undefined in my after hook that generates a screenshot on Status.FAILED

charlierudolph
2018-04-25 14:18:26

*Thread Reply:* Whats the first line in the stack trace?

iiicubed
2018-04-26 11:25:07

*Thread Reply:* thanks for responding, @charlierudolph. here’s a snippet of that stack trace:

/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber/lib/formatter/helpers/eventdata_collector.js:103 if (!step.attachments) { ^

TypeError: Cannot read property ‘attachments’ of undefined at EventDataCollector.storeTestStepAttachment (/Users/scottthompson/WebstormProjects/mx-vtx-ui-enterprise/nodemodules/cucumber/lib/formatter/helpers/eventdata_collector.js:103:16) at emitOne (events.js:115:13) at EventEmitter.emit (events.js:210:7)

charlierudolph
2018-04-27 12:53:29

*Thread Reply:* Looking at the code, I’m guessing that could happen if you attach something (visa https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md) after the step/hook is complete. Can you share the code that attaches something?

GitHub
iiicubed
2018-04-27 13:13:13

*Thread Reply:* sure @charlierudolph :

iiicubed
2018-04-27 13:13:17

*Thread Reply:* After(function (scenario) { const world = this; if (scenario.result.status === Status.FAILED) { if (config.env !== 'dev') scenario.result.exception.stack = null; // eslint-disable-next-line no-undef driver.takeScreenshot().then(screenshot =&gt; { world.attach(screenshot, 'image/png'); if (config.env !== 'dev') driver.quit(); }); } driver.quit(); });

charlierudolph
2018-04-27 13:18:14

*Thread Reply:* Hmm okay. Can you refactor it so the hook so it returns a promise? Its important that cucumber knows the hook is still running. Currently cucumber would move on before the hook finishes running. I can make the cucumber code a bit more defensive so it gives a nicer error message when this happens in the future

iiicubed
2018-04-27 13:28:09

*Thread Reply:* okaaay… i get what your saying about timing out and hookage, but…

iiicubed
2018-04-27 13:28:42

*Thread Reply:* 🤔

charlierudolph
2018-04-27 13:32:35

*Thread Reply:* The cucumber code keeps in internal stepIndex to know what step to attach to when world.attach is called. Since this call happens after the hook finishes, cucumber has incremented the stepIndex to a non-existent step

iiicubed
2018-04-27 13:33:01

*Thread Reply:* oohhhkay… i getchya…

iiicubed
2018-04-27 13:33:40

*Thread Reply:* i see then too why you mentioned updating error messaging also — to be more specific about WHEN that dies

iiicubed
2018-04-27 14:09:10

*Thread Reply:* nice, thanks!!

iiicubed
2018-04-25 10:51:21

and the Googster has a whopping 4 results!!

Michael Stelly
2018-04-25 13:57:56

is there a pure javascript equivalent to the cucumberJS method rowsHash()? I'm using jest-cucumber. I'm trying to pass data table row to my mobx store. With cucumber, I could do this when('Sara provides account information:', userInfo =&gt; { const newMember = userInfo.rowsHash(); and I would have a nice JSON object to work with. I can't do that now, so I need to do something equivalent to that.

charlierudolph
2018-04-25 14:17:29

*Thread Reply:* I’m confused by your question. Is there a javascript equivalent to the cucumberJS method: they would be one and the same.

Michael Stelly
2018-04-25 14:30:18

*Thread Reply:* yea, i'm pretty fried right now. sorry. I meant a pure javascript equivalent. rowsHash() is part of the cucumber-js API. jest-cucumber apparently doesn't support it. I want to take the Feature data table and transform it to a JSON object. Does that help explain?

charlierudolph
2018-04-25 14:45:28

*Thread Reply:* I do not know jest cucumber. I’d try to ask that question on the jest-cucumber support channels

binarymist
2018-04-26 00:01:17

Just having a bit of trouble understanding how the Definition Function Wrapper is intended to be invoked: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/step_definitions.md#definition-function-wrapper

GitHub
Aslak Hellesøy
2018-04-26 02:03:45

Do you have a specific question about it @binarymist?

nEkis
2018-04-26 04:42:22

@nEkis has joined the channel

Michael Stelly
2018-04-26 05:15:12

any thoughts on how to transform a feature data table into a JSON object without using rowsHash() or jest-cucumber? I created a gist that I hope sheds light on what I'm trying to achieve. When I execute jest the user model gets populated incorrectly. I surmise that it's not the model's function updateUser because when I transformed userInfo through CucumberJS rowsHash() into a local object, updateUser worked as intended. https://gist.github.com/mjstelly/33eb652d7b454ebc7cc0d78b4c92275d

Michael Stelly
2018-04-26 05:15:13

@Michael Stelly shared a file: accountCreate.feature

Michael Stelly
2018-04-26 05:15:13

@Michael Stelly shared a file: accountCreate.steps.js

Michael Stelly
2018-04-26 05:15:13

@Michael Stelly shared a file: console.output

Michael Stelly
2018-04-26 05:15:13

@Michael Stelly shared a file: user.js

Michael Stelly
2018-04-26 05:26:58

I logged the forEach() output. The input is garbage (GIGO). I think that's why I need to transform the data table first before passing it to forEach Here's what is processed: ```console.log features/stepdefinitions/accountCreate.steps.js:45 row: { firstName: 'lastName', Sara: 'Lee' } console.log features/stepdefinitions/accountCreate.steps.js:45 row: { firstName: 'email', Sara: 'sara@example.com' } console.log features/step_definitions/accountCreate.steps.js:45 row: { firstName: 'phoneNumber', Sara: '2125551212' }

console.log features/step_definitions/accountCreate.steps.js:45
  row:  { firstName: 'gender', Sara: 'F' }
console.log features/step_definitions/accountCreate.steps.js:45
  row:  { firstName: 'password', Sara: 'slpw' }
console.log features/step_definitions/accountCreate.steps.js:45
  row:  { firstName: 'confirmPassword', Sara: 'slpw' }```
Michael Stelly
2018-04-26 05:54:44

Ok, because jest-cucumber doesn't support rowsHash(), I had to do a hack on the data table. Not my preferred method, but it'll have to do for now. 😦

Michael Stelly
2018-04-26 05:55:35

| key | value | | firstName | Sara | | lastName | Lee | | email | <a href="mailto:sara@example.com">sara@example.com</a> | | phoneNumber | 2125551212 | | gender | F | | password | slpw | | confirmPassword | slpw |

Michael Stelly
2018-04-26 06:01:37

then I changed the call to const user = {}; userInfo.forEach(({ key, value }) =&gt; (user[key] = value)); userStore.updateUser(user); });

binarymist
2018-04-26 10:51:32

Yes @Aslak Hellesøy "how the Definition Function Wrapper is intended to be invoked"? In the example, what calls setDefinitionFunctionWrapper and who/what supplies the callback? What's it's purpose for existence? From that example it's not obvious what it does, other than the very obvious (wrap a function), which anyone could do with a very small piece of code. Do I need to dive into the implementation to have a look?

charlierudolph
2018-04-26 10:53:45

@binarymist its very minimal. It was built to deal with turning generators into async/await (before that was as standard as it is now). A user calls setDefinitionFunctionWrapper

binarymist
2018-04-26 10:54:45

Does it still serve a purpose?

binarymist
2018-04-26 10:55:42

It's reminding me of a post I made over eight years ago: https://blog.binarymist.net/2009/12/24/keeping-encapsulation-on-ones-mind/

Binarymist
Kim Carter (https://blog.binarymist.net/author/binarymist/)
binarymist
2018-04-26 10:56:57

If I'm understanding correctly, that it's no longer used, would it make sense to remove?

charlierudolph
2018-04-26 11:00:06

I believe it is used for other instances, such as wdio-cucumber-framework as a way to run something after a step (and have step level retry) I think that will be better suited with after step hooks (another issue). Once we have those, I want to deprecate it asking people to switch to them and create an issue if there use case is not covered

binarymist
2018-04-26 11:03:32

Don't we have AfterStep hooks now: https://github.com/cucumber/cucumber/wiki/Hooks#tagged-hooks ?

GitHub
charlierudolph
2018-04-26 11:06:10

those are after scenario

binarymist
2018-04-26 11:07:14

Ah... why are they called AfterStep if they're after scenario?

binarymist
2018-04-26 11:09:42

According to that doco, the After is for after scenario, is that incorrect?

charlierudolph
2018-04-26 11:11:34

my mistake. I didn’t follow the link and was assuming you were linking to the cucumber-js docs. Those general cucumber docs are for ruby and are outdated

binarymist
2018-04-26 11:22:49

Oh, right, I should have looked at the js docs first. Sorry.

binarymist
2018-04-26 11:24:47

It's a bit confusing as the before and after hooks work on different points in the main cucumber as opposed to the js cucumber.

binarymist
2018-04-26 11:24:59

I'm guessing there was a valid reason for that?

binarymist
2018-04-26 11:27:45

Oh, dam, the main docs are a bit confusing

binarymist
2018-04-26 11:31:17

Ok, so looks like we just need the AfterStep and BeforeStep now?

charlierudolph
2018-04-26 11:32:49

The main page of the wiki linked to other docs (which I believe are slso outdated)

binarymist
2018-04-26 11:32:56

It's been about 6 years since I've used cucumber, just getting back up to speed.

charlierudolph
2018-04-26 11:33:41

Nevermind, the link on the main page of the wiki links to up to date docs

binarymist
2018-04-26 11:34:01

That's the js docs?

charlierudolph
2018-04-26 11:36:46

Each language has their own set of docs but there also a global docs that is trying to house everything that is shared

binarymist
2018-04-26 11:37:20

mm, I've noticed 😉

binarymist
2018-04-26 11:38:03

Looks like the quality of the js docs are better than the global docs currently. Thanks for the clarification.

🥒 Michael Stelly
👍 Michael Stelly
matt-SmartBear
2018-04-26 12:41:06

Thanks for the feedback @binarymist and sorry you were confused. The team in the #docs channel would love to hear from you if you have more feedback about the docs, we’re actively working on consolidating them at the moment from what historically had become a bit of a mess!

binarymist
2018-04-26 17:50:39

Oh, cool, didn't realise there was a #docs, thanks. Not so much of a problem when the slack is responsive 🙂 Cheers maintainers, keep up the great work.

👍 iiicubed
iiicubed
2018-04-27 12:03:56

curious if anyone had any comments on https://cucumberbdd.slack.com/archives/C6QJ6N695/p1524678639000169

Scott Thompson (https://cucumberbdd.slack.com/team/U9YBYKJGZ)
kappakp
2018-04-27 13:48:16

@kappakp has joined the channel

arjunjh10
2018-04-29 13:25:42

Wonder if anyone else is also experiencing a 404 not found error upon clicking on Cucumber tag expression here https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#tags

GitHub
arjunjh10
2018-04-29 13:26:02

has the link been removed from the official docs and the CucumberJs docs havent been updated?

charlierudolph
2018-04-29 18:32:11

*Thread Reply:* Looks, like it moved to https://docs.cucumber.io/cucumber/api/#tag-expressions. Docs have been updated. Thanks for pointing this out!

arjunjh10
2018-04-29 18:33:26

*Thread Reply:* Thanks @charlierudolph

binarymist
2018-04-29 16:29:05

I'm guessing for And steps, the intention is to just use a Given, When or Then in the step definitions?

arjunjh10
2018-04-29 16:30:24

*Thread Reply:* Yes. You can use Given When Then to define the step that uses And in your gherkin doc

binarymist
2018-04-29 16:30:41

*Thread Reply:* Thought so, thanks.

👍 arjunjh10
binarymist
2018-04-29 16:39:40

This https://github.com/cucumber/cucumber-js/tree/master/features is great doco @charlierudolph. Doesn't look like it's linked to from the main README, but maybe it should be

GitHub
arjunjh10
2018-04-29 18:42:30

I have run into a very weird issue : I have been trying to upgrade cucumber from 2.3.1 to latest that’s 4.2.1 I have made changes to my code and everything has worked fine on my local. But on CI server (TeamCity), the cucumber node module is missing the bin folder that carries the binary, which is why my tests are not able to run coz the folder is non existing. Where should I start to debug this? I am frnakly unable to think

binarymist
2018-04-30 03:07:19

Is there still a place where one would run the cucumber cli with multiple --tags &lt;tag_expression_here&gt;, or is it all done with a single --tags &lt;tag_expression_here&gt;?

binarymist
2018-04-30 03:08:49

Did you try reinstalling it @arjunjh10?

arjunjh10
2018-04-30 15:29:25

*Thread Reply:* Yes. Didnt work So i installed 3.x and it would packaged the bin folder properly. Only difference between 3.x and 4.x in terms of bin folder is the change in name of the cucumber-js binary and addition of the run_slave binary in 4.x

Aslak Hellesøy
2018-04-30 03:38:51

@binarymist it’s just a single expression now

binarymist
2018-04-30 04:16:52

Yeah, cool @Aslak Hellesøy, nothing else seemed to work 😉

Aslak Hellesøy
2018-04-30 04:17:36

Does it work for you with a single --tags "......" then?

binarymist
2018-04-30 04:28:38

Yeah, just took a bit to work out the rules @Aslak Hellesøy.

binarymist
2018-04-30 04:31:30

I'm also wondering if there is a way with the CLI to have it list the feature files that are going to run, based on the tags, etc one has passed as the argv property of the object passed to new cucumber.Cli

binarymist
2018-04-30 04:32:03

Just looking through the source for the cli currently

Aslak Hellesøy
2018-04-30 04:40:51

@binarymist try --help. Is there a --dry-run?

binarymist
2018-04-30 04:48:39

yeah, there is

binarymist
2018-04-30 04:58:07

--dry-run just shows the scenarios and steps as though they had passed (two lines of output, rather than the actual contents of the feature file). Is there an obvious way to extract the contents of what will be run as features?

binarymist
2018-04-30 05:19:44

Just wondering if it's easiest/best to hand role something for myself based on what's already in the CLI or actually extend the CLI?

binarymist
2018-04-30 05:20:46

Seems like extending the CLI would make the most sense, but I'm not sure if the maintainers want it extended?

binarymist
2018-04-30 05:23:07

Maybe running the CLI with a new option?

Aslak Hellesøy
2018-04-30 06:26:11

@binarymist we’re considering basing all cucumber implementations on https://github.com/cucumber/cucumber-pickle-runner so any changes should probably go there.

GitHub
Michael Stelly
2018-04-30 06:28:21

and what is a pickle runner? A test runner like Jest?

Aslak Hellesøy
2018-04-30 06:32:55

The name is misleading - it doesn’t run anything. It loads scenarios and tells a front-end (in e.g. Java/Ruby/Js) what to run.

Aslak Hellesøy
2018-04-30 06:33:02

The README explains it better

len
2018-04-30 06:36:54

@len has joined the channel

len
2018-04-30 06:37:07

What would be the best practise for adding metadata in cucumber (js, cucumber 4) json report? e.g. to use with https://github.com/wswebcreation/multiple-cucumber-html-reporter

Writing my custom formatter? Anyone an example of extending the jsonformatter? (edited)

❓ len
arjunjh10
2018-04-30 12:25:50

*Thread Reply:* I use cucumber-html-reporter module and feed the data to it using the inbuilt json outputer.

len
2018-04-30 23:22:15

*Thread Reply:* @arjunjh10 Yeah, somewhat that plugin is almost similar. I've different metadata for different features - multiple-cucumber-html-reporter supports metadata to be read from the json(s). My problem is how to get it in there?? 🙂

arjunjh10
2018-05-01 11:33:06

*Thread Reply:* @len Ok I’ll tell you the way I get the data through Json in case of my framework My Cucumber.js file

const targetResultJson = `./testoutput/&lt;Filename&gt;.json`;
const commonOptions = `--format json:${targetResultJson} --format summary --require-module ts-node/register --require ui/features/****/**.ts --fail-fast`;

my cucumber-runner.ts file

import ** as reporter from 'cucumber-html-reporter';
const outputDir = `./testoutput/${profileName}`;

process.on('exit', () =&gt; {
      const options = {
        brandTitle: 'Test Report',
        theme: 'hierarchy',
        jsonDir: outputDir,
        output: `${outputDir}/${profileName}test-report.html`,
        reportSuiteAsScenarsios: true,
        launchReport: false,
        storeScreenShots: true
      };

      // This generates HTML report.
      reporter.generate(options);
    });

Hope it helps

len
2018-05-01 12:21:31

*Thread Reply:* ooh, nice. thanks @arjunjh10 , I'll try that process.on('exit' out soon.

👍 arjunjh10
len
2018-04-30 06:39:50

(getting myself into config-hell if I need to add my metadata in a separate process)

Michael Stelly
2018-04-30 06:41:48

@Aslak Hellesøy that readme begs the question: what is a "pickle"?

Aslak Hellesøy
2018-04-30 06:42:43

A pickle is a data structure that identifies a scenario for Cucumber to run.

Michael Stelly
2018-04-30 06:42:56

ah. ok. cool

Michael Stelly
2018-04-30 06:43:20

note to self. more stuff to learn.

arjunjh10
2018-04-30 11:11:13

Regarding my original problem. I forgot to mention, that we package the test project using nuget and upload it to TeamCity. On version 2.3.1 the bin folder was also packaged along with other Cucumber contents. It only seems to be excluding the bin folder from Cucumber 4.2.1. Also, I made no changes to my nuspec package creator file

Arjun Jhawar (https://cucumberbdd.slack.com/team/U6H473WRL)
binarymist
2018-04-30 14:20:23

When is cucumber-pickle-runner going to be a dependency of the cucumber CLI, obviously it's not yet @Aslak Hellesøy?

binarymist
2018-04-30 14:33:41

So it sounds like the answer is: That there isn't currently a way to do this in the CLI, and if we want to implement something in Cucumber (so that the community benefits), then learn Go if we don't already know it, and start hacking on the cucumber-pickle-runner which isn't yet used by the CLI anyway? Alternatively just write some code to read the files ourselves and parse looking for the tags we want?

Kim (https://cucumberbdd.slack.com/team/U9PB97RGT)
arjunjh10
2018-04-30 15:14:59

I reinstalled cucumber but this time chose version 3.2.1 - packaged it using nuget - and my module did contain the bin folder with binary.

So the only thing different between the bin folder on 3.x and 4.x is the run_slave file thats a new addition to 4.x

arjunjh10
2018-04-30 15:15:25

I am not sure if there is anything wrong with it or not, but this definitely makes me suspicious. Thoughts anyone?

arjunjh10
2018-04-30 15:31:55

I got a little more experimental - I changed run_slave file name to run_slave.js and ran packaging again - This time it created the bin folder Does this sound like an issue worth fixing?

arjunjh10
2018-04-30 15:32:42

I mean does this sound like an issue with run_slave file ?

binarymist
2018-04-30 15:36:14

Not sure why the run_slave doesn't have a .js extension, maybe find out where/when it was removed? Just seeing it myself

arjunjh10
2018-04-30 15:36:58

YEah, checking it out

arjunjh10
2018-04-30 15:37:28

as far as I can tell its only included in the codebase in Jan this year.. and has no significant history

arjunjh10
2018-04-30 15:45:31

Looks like the extensions were not used for both the binaries in the Bin folder for 4.x versions

arjunjh10
2018-04-30 15:45:58

https://github.com/cucumber/cucumber-js/tree/3.x/bin

https://github.com/cucumber/cucumber-js/tree/master/bin

GitHub
arjunjh10
2018-05-01 11:33:45

Hey, CucumberJs users, regarding my problem with the binary extensions.. should I raise an issue?

Aslak Hellesøy
2018-05-01 11:35:14

@arjunjh10 please do - after you’ve checked the CHANGELOG for any clues about it

arjunjh10
2018-05-01 11:35:56

@Aslak Hellesøy Thanks

Jon
2018-05-02 02:18:38

@Jon has joined the channel

Jon
2018-05-02 02:21:21

Hey, it is possible in CucubmerJS to run a scenario from another step?

Jon
2018-05-02 02:21:45

We have some scenarios that require expensive and long running setup, which is too slow to run each time.

Jon
2018-05-02 02:22:03

So we have created a snapshotting mechanism, so you can run the setup once, and reload it subsequently.

Jon
2018-05-02 02:22:13

But I'd like to write the setup logic as another scenario, if possible.

Jon
2018-05-02 02:22:38

And then optionally run it and snapshot the result from a Given step.

Aslak Hellesøy
2018-05-02 03:19:17

No you can’t @Jon. Expensive and long-running setup is something teams need to address in order to keep test time short.

Jon
2018-05-02 03:21:58

Sure, I'd just like to express that setup as a scenario, if possible

Aslak Hellesøy
2018-05-02 03:30:45

What’s taking so long in the setup?

Jon
2018-05-02 03:31:18

We have a machine learning platform that builds predictive models

Jon
2018-05-02 03:31:30

So, the setup is to upload a data file and run the model build process

Jon
2018-05-02 03:31:38

That can take a few minutes to a few hours

Jon
2018-05-02 03:32:13

It can be expressed quite succinctly as a scenario, and it something we do want to test in of itself

Jon
2018-05-02 03:32:41

But we also need to snapshot the state of the system and then re-use that as the basis for other scenarios that test post-build functionality

Aslak Hellesøy
2018-05-02 03:33:57

It sounds like your scenario is verifying at least 2 different things: a) The machine learning algorithm b) Being able to process/use the built predictive model

👍 len
Aslak Hellesøy
2018-05-02 03:36:54

Is the built model simple enough that you could build it without the machine learning algorithm?

Given the predictive model is:
  | a table describing essential parts of the model |
When I ask for ....
Then the result should be ....
Aslak Hellesøy
2018-05-02 03:38:10

With this approach, your Given step would build the same kind of model the algorithm would build, only it’s specified in Gherkin. Your scenario is now only about b) above - verifying that your program can use the model.

Jon
2018-05-02 03:39:58

No, the models are very large and complex, and there is a lot of other metadata that is generated prior to the model build itself

Jon
2018-05-02 03:40:28

You have to upload the (large) dataset, which then gets processed to determine the features it contains, their ranges, etc.

Jon
2018-05-02 03:40:54

All of this metadata is required, in addition to the model itself, for post-build functionality to work

Aslak Hellesøy
2018-05-02 03:41:21

I’d recommend adding an abstraction layer in front of the model that allows scenarios to test how it’s queried without worrying about how it’s generated.

Jon
2018-05-02 03:42:46

Well, the snapshotting system we generated is that abstraction

Jon
2018-05-02 03:42:53

Since it lets you put the system into a known state

Jon
2018-05-02 03:43:15

It's just that the generation of that state would be best expressed through a series of steps equivalent to a BDD scenario

Jon
2018-05-02 03:43:54

Of course, we can run an entirely separately process to execute scenarios that generate the snapshots

Jon
2018-05-02 03:44:31

And then the other tests would just have to assume that this has been run correctly by some external orchestration framework we write ourselves

Jon
2018-05-02 03:44:56

But it would be nicer to express these dependencies within Cucumber itself

JJ
2018-05-02 06:59:51

@JJ has joined the channel

JJ
2018-05-02 07:01:31

Hi.. How can I transform datatable data? Like I want to get an object where strings are strings and numbers are numbers?

Michael Stelly
2018-05-02 07:27:04

@JJ From what I’ve learned so far, cucumber doesn’t handle data transformations. It’s job is to identify behaviors. So, the feature is what you want to do. like the well-worn ATM example, Dave wants to withdraw $10 from his account. The scenario are the steps to accomplish this goal. I was taught to describe your steps as if talking to a 19th-century person, i.e. how would one accomplish this goals before the computer age.

Michael Stelly
2018-05-02 07:29:47

So, data transformations, UI widgets, software terms, etc. are all irrelevant in this context. Of course, @Gem will tell you, writing cucumber is more of an art than a reproducible science. You’ll have to find what works for you. This is the exact stage I am in; trying to learn what works for me.

👍 Gem
len
2018-05-02 07:48:35

I don't think tables fit in there though, you'll likely have to parse it in your step definition ( https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/data_table_interface.md )

JJ
2018-05-02 08:03:20

I came across the cucumber-expressions and there's defineParameterTypes but yes.. nothign to to explicit table transfoms. It would just be so useful to have numbers come through as numbers and not strings

MHolland
2018-05-02 09:45:59

@MHolland has joined the channel

len
2018-05-03 00:18:49

Do you use jenkins? how do you see progress? The formatter output seems to be buffered (opposed to console.logs) by jenkins until the tests are completed. i.e. if my test takes 20mins, so I don't see anything going on for 20 minutes.

before writing my custom formatter (how?), I figured someone else might've looking into this already?

Aslak Hellesøy
2018-05-03 00:33:09

@JJ (or anyone else) - would you be interested in porting the new DataTable library to JavaScript? https://github.com/cucumber/cucumber/tree/master/datatable

GitHub
Aslak Hellesøy
2018-05-03 00:33:52

*Thread Reply:* It currently only exists in Java.

JJ
2018-05-03 06:20:33

*Thread Reply:* I'm fairly new to js so I wouldn't feel comfortable just yet

len
2018-05-06 12:55:20

*Thread Reply:* @Aslak Hellesøy just looked a little bit at it. Think its hard to make it work in a untyped language, as you don't specify the type of parameter in the step definition like with java

Is there a way to put tables into the step definition (or is this a good idea?) vs something you 'magically' get passed? ie. Given your feature file is:

When I add the following contacts:
            | name      | email             | age |
            | lennart   | <a href="mailto:lennart@mail.com">lennart@mail.com</a>  | 30  |
            | grandma   |                   | 80  |

Then the cuc expression in your step definition might be:

When('I add the following contacts:[contactlist]', function (contacts)

Instead of (currently)

When('I add the following contacts:', function (contacts) 

? If we had this possibility - registering custom table types wouldn't need to be any different from other custom data types (e.g. just set the transformer to Contact.fromJson)?

Alternatively, we could pass a datatable type into the options of the step definitions (https://github.com/lenntt/cucumber-js/blob/master/src/support_code_library_builder/build_helpers.js#L54)?

Aslak Hellesøy
2018-05-06 14:20:55

*Thread Reply:* I like the suggestion to make it explicit in the expression @len! Angle brackets don’t mean anything yet, and they could be used to identify a table type (converter). We could also use |contactlist| (pipes) to make it look a bit more like a table. @mpkorstanje @charlierudolph I’d be interested in your thoughts on this.

mpkorstanje
2018-05-06 15:30:23

*Thread Reply:* Braindump:

  1. A strong type system is required. This means given a method f(arg) we should not only be able to figure out the type of arg, if arg is a list we should also be able to find it the list item type. (Currently Java8 Lambda expressions fail this test).

  2. If no type system is available we'll have to build a tiny expression language to describe the same type information. E.g. "map of String to List of Double" or {String: [Double]}.

  3. I am currently thinking that passing this into the stepdef will be most worth while.

mpkorstanje
2018-05-06 15:31:19

*Thread Reply:* E.g. Given("my expression", "list of strings") but I hold no strong opinions on this.

mpkorstanje
2018-05-06 15:32:50

*Thread Reply:* 4 Expressing this type system can be done through a an expression in a string or through methods. E.g. "map of int to double" of map(Int, Double). Depending on what is available in the language.

mpkorstanje
2018-05-06 15:33:06

*Thread Reply:* I've appended my thoughts above.

mpkorstanje
2018-05-07 02:55:16

*Thread Reply:* Owh. Better idea for js.

You we can declare the type as an object {"String": ["Double"]}.

Aslak Hellesøy
2018-05-07 12:56:55

*Thread Reply:* So to summarise - we provide a mechanism to declare the table transform type. This is for languages/syntaxes that don’t have static typing (Ruby, JavaScript) and/or sophisticated reflection (Java8 lambdas).

We haven’t settled on the mechanism, but the suggestions are: * [...] at the end of a cucumber expression (I don’t really like that, thinking about it) * a 2nd argument following the Cucumber Expression (or RegExp). The type/structure of this argument is still to be determined (String, Dictionary, other…)

mpkorstanje
2018-05-07 13:02:50

*Thread Reply:* Dictionary --> Object. A list of double is ["Double"] a map of String to Double is {"String": "Double"}.

len
2018-05-08 06:30:02

*Thread Reply:* @Aslak Hellesøy 1) square brackets are just an example, can live with other characters (I don't even see why not just {...}). 2) 2nd argument: there is already an optional 'options' object 2nd argument (https://github.com/cucumber/cucumber-js/search?q=buildStepDefinition&type=Code&utf8=%E2%9C%93).

I'm not seeing the 2nd work doing an automatic transform yet, (my guess is most of the times, when writing my own transformer, I'll be calling a constructur or something - basic data types wouldn't suffice.) @mpkorstanje, if we stick to the contactlist example above, what would the second argument look like?

Aslak Hellesøy
2018-05-08 06:33:00

*Thread Reply:* @len - Cucumber Expressions currently have no knowledge of DataTables. It is a standalone library. I think it’s cleaner to keep it dependency-free. That excludes declaring tables in Cucumber Expressions. It’s a bit weird to add it there - it has nothing to do with matching steps.

mpkorstanje
2018-05-08 06:45:23

*Thread Reply:* @len It would look like this: When('I add the following contacts:', ['contact'], function (contacts))

And somewhere else you'd have to register a data table type:

typeregistry.defineDataTableType(new DataTableType( "contact", new TableEntryTransformer(entry =&gt; new Contact(entry)); ));

len
2018-05-08 06:50:42

*Thread Reply:* Think I got it, thanks.

So basically the only difference between the normal CustomDataType and the CustomTableDataType, would then be that the transformer in the latter iterates over all entries? @mpkorstanje

mpkorstanje
2018-05-08 06:55:18

*Thread Reply:* That would depend on the transformer. You can iterate on the individual cells, the entries - (header, value) pairs -, the rows, or the whole table at once.

mpkorstanje
2018-05-08 06:56:35

*Thread Reply:* That'd be TableCellTransformer, TableEntryTransformer, TableRowTransformer and TableTransformer respectively.

mpkorstanje
2018-05-08 06:58:35

*Thread Reply:* These can be combined to some degree:

For example transforming this table to {String: Coordinate}

|      | latt      | long        |
| KMSY | 29.993333 | -90.258056  |
| KSFO | 37.618889 | -122.375    |
| KSEA | 47.448889 | -122.309444 |
| KJFK | 40.639722 | -73.778889  |

Would use the build in TableCellTransformer for String and the custom TableEntryTranformer for Coordinate.

mpkorstanje
2018-05-08 07:00:44

*Thread Reply:* If the table didn't have header you'd have to declare a TableRowTransformer instead.

len
2018-05-08 07:09:51

*Thread Reply:* Ok, cool.

Seems option #1 (building into expressions) is not really an option? (I can still give some arguments for that)? @Aslak Hellesøy

Aslak Hellesøy
2018-05-08 07:11:36

*Thread Reply:* @len if you’re planning to port the library to JavaScript (would be amazing BTW), the right place to do that would be in a javascript directory under https://github.com/cucumber/cucumber/tree/master/datatable

GitHub
Aslak Hellesøy
2018-05-08 07:12:21

*Thread Reply:* We can then work on integrating it into cucumber-js. How does that sound?

len
2018-05-08 07:13:06

*Thread Reply:* Sounds great, I'll definitely look into it. If I have any, what would a good place to ask questions, this thread?

mpkorstanje
2018-05-08 07:31:00

*Thread Reply:* Let's discuss it in the PR. Slack messages disappear after a while.

👍 len, Aslak Hellesøy
mpkorstanje
2018-05-08 07:32:41

*Thread Reply:* Also, gotta think about a shared test suite.

mpkorstanje
2018-05-08 07:34:12

*Thread Reply:* Table + type --> json. Doesn't cover everything, but should cover the common parts.

len
2018-05-10 12:19:12

*Thread Reply:* @Aslak Hellesøy @mpkorstanje PR is here, quite rough, but I need to know if I'm on the right track before continuing https://github.com/cucumber/cucumber/pull/385

GitHub
JJ
2018-05-03 06:23:39

Anybody experience attaching a json string with long values? The attach function rounds the values.
jsontext = "[{"key":476007500100000067,"request time":"20180503T12:47:39.115Z","response time":"20180503T12:47:39.221Z"}]" It attaches to the results.json as: { "key": 476007500200000100, "request time": "2018-05-03T12:47:39.115Z", "response time": "2018-05-03T12:47:39.221Z" } BUT if I attach as string then I see the correct key value.

Michael Stelly
2018-05-03 09:31:41

*Thread Reply:* fyi you can wrap multi-line code snippets in triple-backtick ``` for easier reading

Michael Stelly
2018-05-03 09:32:32

*Thread Reply:* like this jsontext = "[{"key":476007500100000067,"request time":"2018_05_03T12:47:39.115Z","response time":"2018_05_03T12:47:39.221Z"}]" It attaches to the results.json as: { "key": 476007500200000100, "request time": "2018-05-03T12:47:39.115Z", "response time": "2018-05-03T12:47:39.221Z" }

len
2018-05-03 13:03:14

I just forked cucumber-js, but I'm new to yarn, work with npm myself. I ran yarn install. when I do yarn test, it picks up eslint from my path, which i globally installed via npm. and complains about missing plugins, like babel. whats normal practise?

len
2018-05-03 13:29:10

Hmm, installed via npm, get 5 lint errors by prettier/prettier, guess thats not supposed to happen, e.g.

              `${this.feature1Path}:1${separator.expected}${this
                .feature2Path}:2`

eslint wants it to be:

              `${this.feature1Path}:1${separator.expected}${
                this.feature2Path
              }:2`
Michael Stelly
2018-05-03 19:09:24

This is my go-to site https://yarnpkg.com/en/docs/cli/

yarnpkg.com
Michael Stelly
2018-05-03 19:09:43

did you try yarn upgrade?

len
2018-05-04 00:10:31

why would i need to upgrade right after install?

Michael Stelly
2018-05-04 05:47:37

it’s just a double-check to make sure you have the latest versions of the packages described in your package.json. You could probably skip it, but it doesn’t hurt and it’s quick.

Edgar Post
2018-05-04 06:44:12

@Edgar Post has joined the channel

mpkorstanje
2018-05-06 15:17:14

@mpkorstanje has joined the channel

JJ
2018-05-07 10:45:14

in what time format does cucumber report? ms ns?

arjunjh10
2018-05-07 11:35:13

ms, if i recall correctly 🤔

binarymist
2018-05-08 20:38:01

Anyone got any idea why exceptions can't be caught inside steps? I have a promise rejection that I'm handling, but cucumber seems to be ignoring my handling code.

len
2018-05-09 01:38:15

@binarymist Can you show what your (simplified) step looks like?

binarymist
2018-05-09 01:51:15

I have a sequence of:

binarymist
2018-05-09 01:51:17

When('the active scanner is run', async function () { await (async () => { await (function setAuthenticationCredentials() { return new Promise((resolve, reject) => { zaproxy.users.setAuthenticationCredentials( param1, param2, etc,
(err, resp) => { if(err) { // Anything thrown or rejected here, fails the step. } resolve(resp); } ); }); }()); await (function setAuthenticationCredentials() { return new Promise((resolve, reject) => { zaproxy.users.setAuthenticationCredentials( param1, param2, etc,
(err, resp) => { if(err) { // Anything thrown or rejected here, fails the step. } resolve(resp); } ); }); }()).then(outcome => onCompletion(outcome)); })(); });

binarymist
2018-05-09 01:51:46

No matter where I put the then or catch, it's never executed.

len
2018-05-09 01:54:15

haven't played much with await/async yet. I'm guessing the outer function is async - does cucumber support that? Why not remove the await and return the promise directly? And are you sure you call reject?,

 return new Promise((resolve, reject) =&gt; {
   zaproxy.users.setAuthenticationCredentials(
     param1, param2, etc,  
     (err, resp) =&gt; {
       if(err) {
         // Anything thrown or rejected here, fails the step.
         reject(err)
       }
       resolve(resp);
     }
   );
 });
binarymist
2018-05-09 01:55:05

Correct: the outer function is the step function

binarymist
2018-05-09 01:55:55

Actually, that's not quite true, there is one more between the step function and the one I pasted, I'll tidy it a bit more

binarymist
2018-05-09 02:01:22

Ok @len, that's it. The two sub functions are identical in this example, there are a few of them, but the structure are currently the same.

binarymist
2018-05-09 02:03:41

It's not a big deal, I'm simplifying (dry'ing) it out currently. I've got a work around for now, but curious to know if this is expected behavior? From the googling I did, it seems to be.

binarymist
2018-05-09 02:06:32

I may also be missing a couple of asyncs

len
2018-05-09 02:11:45

I'd expect cucumber steps to fail if the returned promise rejects properly. I'm not quite convinced yet its cucumber here, but your control flow missing something.

Is it possible your handler calls both reject and resolve? Are you able to reproduce with a simpler working example?

binarymist
2018-05-09 02:14:06

reject didn't appear to do anything, throw fails the step immediately.

binarymist
2018-05-09 02:14:38

I was trying to catch the rejection though, but it never worked.

binarymist
2018-05-09 02:15:21

I'm going to put all the functions in an array and map over them... try and simplify a bit.

vadym romaniak
2018-05-10 05:42:48

@vadym romaniak has joined the channel

boris_osipov
2018-05-14 11:03:48

@boris_osipov has joined the channel

wozi
2018-05-14 13:29:14

@wozi has joined the channel

wozi
2018-05-15 10:52:13

Hello guys! Quick question, is there any way to use And/But in step definitions? i was using defineStep in cucumber 3 but now i'm using 4 and i'm kinda lost 😛 Thanks!

Cat
2018-05-15 10:58:06

*Thread Reply:* And, yes - you would simply write the step definition as the parent it belongs to. For example: Given I have a condition And I have another condition the And here would actually be a Given when you write out your step defs. Iirc, But is no longer used.

wozi
2018-05-15 11:09:09

*Thread Reply:* Yeah that's what I'm doing right now, replacing the Ands with Givens, but I was wondering if there was a way to add it so the step is And(/^bla bla$/)

thanks! 😄

len
2018-05-15 11:09:15

*Thread Reply:* Perhaps you mean https://stackoverflow.com/questions/50104494/cucumberjs-and-gherkin-why-can-not-i-use-and-and-but-steps/50249795#50249795 ?

Stack Overflow
wozi
2018-05-15 11:10:43

*Thread Reply:* That's a shame, I'll have to use given 😞

Thanks you guys

Yakim Rachev
2018-05-16 08:41:32

@Yakim Rachev has joined the channel

Yakim Rachev
2018-05-16 08:50:13

Hello all, I’m new to CucumberJS and having problem that cannot solve 3 days now 😞 I’m having nodejs 10 project with cucumber 4.2.1, selenium-webdriver 4.0.0-alpha.1 and opencv4nodejs 4.4.0 When I run my feature file, All steps in all scenarios are run simultaneously without waiting each other. As a result 6 instances of FF start immediately after running my feature file. I haven configured anything (intentionally) to run scenarios in parallel.

len
2018-05-16 08:56:27

*Thread Reply:* @Yakim Rachev my first guess: async selenium js is async, so either your tests need a properly resolving promise or use a callback on the step definition

💯 Cat
👍 iiicubed
Yakim Rachev
2018-05-16 09:05:10

*Thread Reply:* Hi @len. Thaks for the quick reply. I'm aware of selenium async nature, and in my words.js file I call selenium functions with await.

Cat
2018-05-16 13:04:39

*Thread Reply:* are you able to share a sanitized config file for your cuke and selenium setup?

iiicubed
2018-05-18 10:23:24

*Thread Reply:* while i haven’t tried using async/await @Cat, i am having success just using promises.

iiicubed
2018-05-18 10:24:42

*Thread Reply:* assertions not resolving promises were giving me grief. using chai-as-promised and asserting, say:

element.getText().should.become(text, 'The text did not match:');

Yakim Rachev
2018-05-18 11:39:44

*Thread Reply:* Hi there. I think I’ve got the problem… As I said I’m new to CucumberJS (also to NodeJS). In my step definitions was not returning the result from the webdriver methods call. I went to nightwatch-cucumber, now and the thinks happens more easy. Thanks all

👍 iiicubed
Ahmed
2018-05-16 20:06:57

@Ahmed has joined the channel

Fabien
2018-05-18 03:26:49

@Fabien has joined the channel

iiicubed
2018-05-18 10:21:33

correct me if i’m wrong, but it seems one cannot debug (in, say, WebStorm… others are probably similar…) when --parallel is set?

Ed Snodgrass
2018-05-22 20:27:26

When I clone cucumber-js, do an npm i and then npm test i am getting linting errors. when I run npm run lint-autofix to correct those linting errors I get a failing Scenario: Scenario: extending SummaryFormatter # features/custom_formatter.feature:61. Any thoughts?

Ed Snodgrass
2018-05-22 20:29:44

*Thread Reply:* I get more failures when running on windows and I have to update the package.json to have "set BABEL_ENV=browser;

Ed Snodgrass
2018-05-22 20:35:44

*Thread Reply:* In order to check my sanity I created a Docker container running ubuntu 16.04, npm 5.6.0, and nodejs 8.11.2, that is when I still get the linting errors and after the auto-fix I still get the one failing scenario.

Giovanni
2018-05-23 05:54:47

@Giovanni has joined the channel

Giovanni
2018-05-23 05:54:53

Hi Friends

Giovanni
2018-05-23 05:55:03

I need you help

Giovanni
2018-05-23 05:55:13

Actually, I am working with cucumber in serenity-js and I need to work with the words Feature, Given, When, Then in spanish, I was testing with " # language: es " but this didnt work , How to can setup the protactor files or serenity-js files for use this feature?. Thansk for the help

Karl
2018-05-23 07:00:37

@Karl has joined the channel

Karl
2018-05-23 07:02:54

I am wondering if someone can help me, I am looking to turn our framework in a node module, in doing so, i need to split the "feature" file folder and the "step-definitions" folder, but i don't seem to be able to work out how to set this via arguments on run? am i missing something or can it not be done?

Cat
2018-05-23 07:05:51

*Thread Reply:* If I’m understanding the question correctly, you’d be able to simply pass the step defs folder into the require arg and just point to the features directory

Karl
2018-05-23 07:08:33

*Thread Reply:* me to...this is what i tried...

Karl
2018-05-23 07:09:01

*Thread Reply:* not sure how i can post my code...

Cat
2018-05-23 07:09:22

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md you’ve followed this doc?

GitHub
Karl
2018-05-23 07:09:35

*Thread Reply:* '/nodemodules/cucumber/bin/cucumber.js --require ./nodemodules/sc-caf-module-test/test/features/step-definitions --tags @component ./tests -f json:./tests/reports/cucumber-report.json'

Karl
2018-05-23 07:10:03

*Thread Reply:* but all my steps are failing as undefined

Cat
2018-05-23 07:12:42

*Thread Reply:* Based on that doc I sent, it looks like your step defs should be passed through as : &lt;DIR&gt;/****/**.js

Karl
2018-05-23 07:13:32

*Thread Reply:* ah ok...let me try that...

Cat
2018-05-23 07:13:54

*Thread Reply:* although if you’re keeping it in the features dir it could just be: features/****/**.js

Cat
2018-05-23 07:14:02

*Thread Reply:* (also as per the doc)

Karl
2018-05-23 07:14:52

*Thread Reply:* ok, ill continue to play, as i have tried what it is saying in the doc, i guess im just missing something....

Karl
2018-05-23 07:15:01

*Thread Reply:* thank you for taking the time to help me

Cat
2018-05-23 07:19:00

*Thread Reply:* np - out of curiosity, is your support code JS browser compatible? Or is it es6, etc?

Cat
2018-05-23 07:19:36

*Thread Reply:* If it’s not been compiled, this happens 🙂

Mohit
2018-05-23 07:25:55

@Mohit has joined the channel

binarymist
2018-05-24 19:22:26

I'm having an issue when running the cli more than once in code. I get "Cannot read property 'stepDefinitions' of undefined". It doesn't seem to matter if I create a new cucumber.Cli(args in here)

binarymist
2018-05-24 19:57:09

Any tips on running twice?

binarymist
2018-05-24 22:10:19

When I try spawning a process as I used to here https://github.com/cucumber/cucumber-js/issues/786#issuecomment-372928596 , I get: stderr: Error: Cannot find module

binarymist
2018-05-24 22:10:43

That's from the world.js

Marx
2018-05-25 14:30:27

@Marx has joined the channel

Marx
2018-05-25 14:31:52

Bringing a discussion here from #help.

Context: I am trying to pass an environment variable to my Cucumber test suite. So I can setup my tests with it on different environments.

// In my steps

if ( this.env === 'production') {
 url = '<a href="http://www.production-site.com">www.production-site.com</a>'
} else {
 url = '<a href="http://www.stage-site.com">www.stage-site.com</a>'
}

The script I am running is not giving me the environment variable I need, I.e this.env = undefined. This is the script:

cucumber-js --world-parameters "{\"env\":\"production\"}" the \ are used to escape "

Marx
2018-05-29 09:14:17

*Thread Reply:* Bump of desperation. Does anyone have experience in world-parameters?

len
2018-05-29 09:58:16

*Thread Reply:* I haven't used them, but what you could try is passing system environment variables instead?

TEST_ENV=production./node_modules/.bin/cucumberjs ...

(depends a bit on your setup and OS) then in your code:

if (process.env.TEST_ENV === 'production') ...
len
2018-05-29 10:01:30

*Thread Reply:* @Marx instead of this.env, I'd try this.parameters.env

Marx
2018-05-29 11:03:12

*Thread Reply:* @len Nice, that helped.

This is my package.json for those who may be facing similar problems.

  "scripts": {
    "test": "cucumber-js features",
    "test-prod": "TEST_ENV=production npm run test",
    "test-stage": "TEST_ENV=development npm run test"
  },

then in my hooks.js

if (TEST_ENV === 'production') {
// Do prod setup
} else if (TEST_ENV === 'development') {
// Do dev setup
}
👍 len
charlierudolph
2018-05-26 10:28:16

Are you using a custom world constructor? The world parameters get passed to it: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/api_reference.md#setworldconstructorconstructor

GitHub
Giovanni
2018-05-27 06:20:41

Hi Friends I need you help Actually, I am working with cucumber in serenity-js and I need to work with the words Feature, Given, When, Then in spanish, I was testing with " # language: es " but this didnt work , How to can setup the protactor files or serenity-js files for use this feature?. Thansk for the help

Alonso
2018-05-28 06:37:59

@Alonso has joined the channel

Alonso
2018-05-28 06:39:16

Hi all. Is there a to add properties to the json report besides the result of the test.

Alonso
2018-05-28 06:39:30

E.g. "steps": [ { "arguments": [], "keyword": "When ", "line": 4, "name": "I register with phone number '6623471507'", "match": { "location": "support/steps/customer/auth.js:5" }, "result": { "status": "passed", "duration": 6000000, "request": "..." &lt;-- Custom property } },

mpkorstanje
2018-05-28 06:40:33

Not much of a Js user. But you can write your own formatter. Though I think you're looking for something like scenario.write.

Alonso
2018-05-28 06:42:53

Cool! Thanks @mpkorstanje I think scenario.write may work. Do you or anybody knows how to use it in cucumber-js?

mpkorstanje
2018-05-28 06:44:06

The docs for js don't include examples. https://docs.cucumber.io/cucumber/api/#hooks

But you can put a debugger on it an see what methods scenario has

mpkorstanje
2018-05-28 06:44:17

Or hit the source code.

mpkorstanje
2018-05-28 06:44:33

And perhaps send a PR once you've figured it out to improve said docs. 😄

Alonso
2018-05-28 06:44:59

sounds good 👍

len
2018-05-28 10:28:50

@Alonso I don't think you can change the results the built-in json formatter writes back directly (if I'm wrong, please correct me!!),

but perhaps you can workaround with this: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md I wouldn't mind a better solution to set, for a similar case, fill metadata property on a feature, e.g. to use https://github.com/wswebcreation/multiple-cucumber-html-reporter#metadata more directly.

GitHub
GitHub
mpkorstanje
2018-05-28 10:30:06

Owh that's where they keep the JS docs. 😄

len
2018-05-28 10:35:34

*Thread Reply:* @mpkorstanje takes a while to get used to - I was in the cucumber-js docs like 'WHERE IS CUCUMBER-EXPRESSIONS' 🙂.

Alonso
2018-05-28 10:31:07

wow this will help me a lot! Thanks @len!

👍 len
Alonso
2018-05-28 11:39:37

@len I see the attachments are generated as embeddings in json formatter

Alonso
2018-05-28 11:39:39

"steps": [ { "arguments": [], "keyword": "When ", "line": 5, "name": "I send request to get product offers", "match": { "location": "support/steps/customer/offers.js:6" }, "result": { "status": "passed", "duration": 18000000 }, "embeddings": [ { "data": "POST /offers", "mime_type": "text/plain" }, { "data": "{}", "mime_type": "application/json" }, {

Alonso
2018-05-28 11:40:10

does multiple-cucumber-html-reporter print these or do you know any html reporter that renders them?

len
2018-05-28 11:44:46

yeah, multiple-cucumber-html-reporter prints them, so do most others, like https://github.com/gkushang/cucumber-html-reporter

GitHub
😁 Alonso
Vaene
2018-05-28 20:16:21

@Vaene has joined the channel

Vaene
2018-05-28 21:00:29

Sorry for newby question, but how do we turn on the cucumber-report.json in cucumber.js? I see this: https://github.com/john-doherty/selenium-cucumber-js/blob/7238c9bf966bab0ca0805445130c7754fb5e14aa/index.js#L100 but I'd like to get reports going on https://github.com/Adezandee/cucumber-mink

GitHub
GitHub
len
2018-05-29 09:53:28

*Thread Reply:* @Vaene I dont understand the question, do you want want a json report output? or use cucumber-mink? (I dont think those two are related?)

I can probably only help with the first one. How do you run your tests now?

Vaene
2018-05-29 13:55:53

*Thread Reply:* Hi Len, thanks for the reply. Yes I just want to setup cucumber to write cucumberreport.json by default. I can do it via command line now (figured it out after I posted) with: npx cucumber-js --format json > ./reports/cucumberreport.json features/my-smoke.feature

👍 len
Vaene
2018-05-29 13:57:37

*Thread Reply:* The selenium links is just by way of example of how they are handling it. I like everything about the selenium-cucumber, I just like the access to the mink step definitions that cucumber-mink has.

len
2018-05-30 10:42:07

*Thread Reply:* Reminds me of web_steps, be aware, danger ahead: http://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off

Aslak Hellesøy
Vaene
2018-05-31 09:43:14

*Thread Reply:* Yeah I gotcha but the Gherkin appeal is also so non programmer stake holders can write simple tests in their tickets to see basic functionality replicated. 85% of what we do falls into this boring training wheel area, the rest we can handle with more specialized mocha, etc tests

Vaene
2018-05-31 09:53:57

*Thread Reply:* What I'd like to do is have the test run, output a cucumber_report.json, and then have cucumber-html-reporter render that in pretty html. the selenium repo does that automatically, I am trying to replicate that functionality in the mink repo.

charlierudolph
2018-05-31 21:31:35

The world parameters are an alternative to env variables. Docs on world: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/world.md#world, features with examples: https://github.com/cucumber/cucumber-js/blob/master/features/world_parameters.feature

GitHub
GitHub
Aslak Hellesøy
2018-06-01 02:33:49

Hey @channel - please vote on Cucumber Expression/Parameter Type support in WebStorm: https://youtrack.jetbrains.com/issue/WEB-31420

YouTrack
👌 dmshamonov, Ed Snodgrass
Gem
2018-06-01 07:47:31

*Thread Reply:* Done!

jprealini
2018-06-07 12:39:05

@jprealini has joined the channel

jprealini
2018-06-07 12:40:41

Hi... I am having a strange problem. I setup some tagged hooks for setting up and cleaning test data for some scenarios. Thing is that if a scenario that uses those hooks is the last one to be executed, the after hook won't run... Has anyone seen that?

Mike
2018-06-20 06:48:13

@Mike has joined the channel

David Arshavsky
2018-06-21 01:34:10

@David Arshavsky has joined the channel

David Arshavsky
2018-06-21 01:57:10

Hi, we want to use the Cucumber for android and we want to be sure that it will continue to be supported for future years, from what info we can know this kind of thing ? That it will continue supporting running with Espresso and other frameworks ?

David Arshavsky
2018-06-21 02:10:17

@Aslak Hellesøy

Aslak Hellesøy
2018-06-21 06:23:09

@David Arshavsky Cucumber for Android is written in Java - did you mean to post this in <#C5YHPPJMP|help-cucumber-jvm>?

David Arshavsky
2018-06-21 07:00:21

Probably 🙂

David Arshavsky
2018-06-21 07:00:44

Does it matter if we will use Kotlin to write the automation ?

Cat
2018-06-21 07:03:22

*Thread Reply:* While kotlin is interoperable w/Java and Android, the javascript channel probably isn’t the place to post? 🙂

David Arshavsky
2018-06-21 07:58:29

*Thread Reply:* Just want to be sure that Cucumber will will work with all platforms for years to come

David Arshavsky
2018-06-21 07:59:24

*Thread Reply:* We have more then 20 teams that stating using it and we need to know that in 1 year it will still work on all platforms and be supported, who can help me to understand this?

Cat
2018-06-21 08:06:16

*Thread Reply:* Try the main #help channel perhaps?

Cat
2018-06-21 08:06:39

*Thread Reply:* @matt-SmartBear may be a good resource as well 🙂

matt-SmartBear
2018-06-21 08:15:07

*Thread Reply:* @David Arshavsky we’re building a company around the open-source product. I’m one of the original OSS contributors, a co-founder of the company and the CEO. We don’t intend on going anywhere 🙂

Aslak Hellesøy
2018-06-21 14:03:49

*Thread Reply:* @David Arshavsky that said, we rely on contributions from the community to keep things going. We recently stopped supporting some Cucumber-JVM modules because we didn’t have bandwidth to support them: https://cucumber.io/blog/2018/05/19/cucumber-jvm-languages-support

cucumber.io
Aslak Hellesøy
2018-06-21 14:04:22

*Thread Reply:* I suggest we move this conversation over to <#C5YHPPJMP|help-cucumber-jvm> since this doesn’t seem related to JavaScript/Cucumber.js

Aslak Hellesøy
2018-06-21 14:54:34

*Thread Reply:* As you can see from the stats in that post, Cucumber-Android accounts for 0.14% of the usage of Cucumber-JVM. Since you have 20 teams using Cucumber-Android, would you consider giving something back to the community by encouraging some of these developers to contribute to Cucumber-Android? That’s the best assurance you can get that it will stick around.

David Arshavsky
2018-06-22 00:51:22

*Thread Reply:* The teams mostly using it for web and some for iOS, now we wanted to try it on Android as well, so I understand that you stop supporting because low numbers of usage at this point. I will speck with our QA leads and see what they say about supporting. Any numbers on iOS?

Aslak Hellesøy
2018-06-22 01:06:20

*Thread Reply:* Our intention is to continue to make new releases of Cucumber-Android ad the underlying Cucumber-JVM evolves. How long we’ll be able to do that depends on contributions from users. How many people use it without contributing doesn’t affect the decision as much.

Aslak Hellesøy
2018-06-22 01:09:08

*Thread Reply:* There is no official Cucumber for iOS, but there is a semi-official one that the Cucumber team doesn’t maintain. See http://docs.cucumber.io/installation/ and https://github.com/Ahmed-Ali/Cucumberish. It’s also in need of new maintainers. I don’t have any downloads stats for it.

GitHub
David Arshavsky
2018-06-22 03:56:53

*Thread Reply:* So I understand that your team focus at this moment are more for web then Android /iOS ?

Aslak Hellesøy
2018-06-22 05:34:22

*Thread Reply:* Our main focus is on 4 implementations: Java, JavaScript, Ruby and .NET. No Cucumber implementations know anything about the Web (HTTP,DOM etc). People can use any of the implementations to test web applications, but you need to add additional libraries to the mix for that (Selenium WebDriver being the most popular one). Cucumber doesn’t know or care what UI automation library you use to interact with a UI.

👍 David Arshavsky
💯 Cat
Cat
2018-06-22 07:24:11

*Thread Reply:* ^^ to expand on that: There’s nothing stopping you from using appium/its equivalent in conjunction w/Cucumber. Same as any other runner.

Charan
2018-06-23 18:38:43

@Charan has joined the channel

Aasim Anwar
2018-06-28 07:38:12

@Aasim Anwar has joined the channel

Aasim Anwar
2018-06-28 07:42:34

Hi Folks! I need a help, I am unable to open a web page (I have just started using the Cucumber).

_stepdefination.js__

this.Given(/^I am on the login page$/, function (callback) { browser.get("URL").then(function(){ callback(); // })

});

Cat
2018-06-28 07:47:03

*Thread Reply:* what error are you getting?

Aasim Anwar
2018-06-28 07:52:27

*Thread Reply:* Unhandled rejection ReferenceError: Given is not defined

Cat
2018-06-28 07:55:39

*Thread Reply:* Yes. you have to define Given.

Cat
2018-06-28 07:55:48

*Thread Reply:* e.g., import { Given } from ‘cucumber’;

Aasim Anwar
2018-06-28 08:01:07

*Thread Reply:* How and where to define Given? 😞

Can you please just put a code here to open any web-page? (for e.g. google.com)

Cat
2018-06-28 08:13:03

*Thread Reply:* ```_stepdefination.js__ import { Given } from 'cucumber'; this.Given(/^I am on the login page$/, function (callback) { browser.get("URL").then(function(){ callback(); // })

});```

Cat
2018-06-28 08:13:33

*Thread Reply:* you have to define the variable before you reference it

Aslak Hellesøy
2018-06-28 14:59:45

*Thread Reply:* Remove the this. in front of Given @Cat

Aasim Anwar
2018-06-28 23:52:20

*Thread Reply:* Still not working!

import { Given } from 'cucumber'; Given(/^I am on the login page$/, function (callback) { browser.get("https://www.mysite.com/").then(function(){ callback(); // })

});

Aslak Hellesøy
2018-06-29 00:29:46

*Thread Reply:* Any error message?

Aasim Anwar
2018-06-29 01:20:12

*Thread Reply:* Many errors, I can see..

Unhandled rejection /home/ttpllt21/Desktop/cucumber/stepDefinitions.js:1 (function (exports, require, module, _filename, _dirname) { import { Given } from 'cucumber';

Cat
2018-06-29 06:15:32

*Thread Reply:* I assume you haven’t used something like babel for the es6?

len
2018-06-29 12:58:20

*Thread Reply:* node version / loader? try

const Given = require('cucumber').Given: 
Aasim Anwar
2018-06-30 00:45:33

*Thread Reply:* Thank you all, but, still, nothing is working.

I am running it with Protractor

_conf.js_ exports.config = { directConnect: true, framework: 'custom', frameworkPath: '/home/ttpllt21/nodemodules/protractor-cucumber-framework', capabilities: { 'browserName': 'chrome' }, cucumberOpts: { format: "summary" }, specs: ['./**.feature'] };


--------home.feature--------- Feature: Homepage

Scenario: Visit Homepage Given I am on the homepage


------step.js------------

const Given = require('/home/ttpllt21/node_modules/cucumber').Given(/^I am on the login page$/, function (callback) { browser.get("https://www.mysite.com/").then(function(){ callback(); // })

});

len
2018-06-30 02:01:51

*Thread Reply:* nothing is working is not enough for us to help debugging 😉 Did you turn on your pc? 😈

Aasim Anwar
2018-06-30 02:12:58

*Thread Reply:* Yes! PC is on! 🤣 script is not working, I am just new and have no basic idea about cucumber, I have tried to read articles and none of them helped.

Aslak Hellesøy
2018-06-30 08:42:51

*Thread Reply:* @Aasim Anwar I recommed you read this then ask again: https://opensource.com/life/16/10/how-ask-technical-questions

Opensource.com
Sebid
2018-07-03 01:22:19

@Sebid has joined the channel

mic
2018-07-06 09:44:03

@mic has joined the channel

mic
2018-07-06 09:49:02

G'day mates! Currently looking into cucumber-js to start BDD'ing a large react app - running into some resistance with setting up the project. Is therea place to start with documentation how to set up a project to test with cucmber-js, react, babel etc.? Any help greatly appreciated! (and thanks for the library...sweet as!!)

Cat
2018-07-06 11:48:23

*Thread Reply:* the babel docs are pretty thorough as far as setup if you’re wanting to use ES6

Cat
2018-07-06 11:48:38

*Thread Reply:* for cuke itself: I’d look at some of the example projects.

Sebid
2018-07-09 02:20:55

regarding cucumber-js, I'm having some trouble debugging a migration from v1.3.3 to v2+, it seems that by upgrading the cucumber version, the simple test I made for a PoC is not detecting step_definitions anymore. v1.3.3 properly detects them

Sebid
2018-07-09 02:23:32

(sorry for still using github 🙂 )

Sebid
2018-07-09 02:25:03

For the moment it works with 1.3.3, but it would be great to have it running on a recent 3x-4x

Sebid
2018-07-09 02:25:11

Any ideas?

nEkis
2018-07-09 05:42:06

*Thread Reply:* try to require step definitions exactly require: './step_definitions/****/**_steps.js', => require: './step_definitions/login/login_steps.js',

nEkis
2018-07-09 05:43:59

*Thread Reply:* and it may have to be array, so require: [ './step_definitions/login/login_steps.js' ],

Sebid
2018-07-09 05:52:28

*Thread Reply:* It does not appear to be that as I've tried with or without wildcard**s and under array form.

len
2018-07-09 10:37:30

*Thread Reply:* I remember having to change this.When(... to When(... (where when is required from cucumber)

Sebid
2018-07-10 01:34:19

*Thread Reply:* that is ES6 syntax if I'm not mistaken

Sebid
2018-07-10 01:34:45

*Thread Reply:* I'll try refactoring the steps when I have time, currently I've decided on 1.3.3

nirmal
2018-07-10 05:46:59

@nirmal has joined the channel

appleJuice
2018-07-10 23:26:49

@appleJuice has joined the channel

appleJuice
2018-07-10 23:27:06

Hi I have a problem with arguments passed to a function from step definition

appleJuice
2018-07-10 23:28:10

when i try this defineStep('accedo al movimiento "{string}" del producto "{string}" y pantalla "{string}"', async function (movimiento, producto, pantalla) { await goToMovements()}); async function goToMovements(position, page, route = '') { ... }

appleJuice
2018-07-10 23:28:19

everything is OK

appleJuice
2018-07-10 23:29:29

but when i try this defineStep('accedo al movimiento "{string}" del producto "{string}" y pantalla "{string}"', goToMovements);, Cucumber throws this error function has 2 arguments, should have 3 (if synchronous or returning a promise) or 4 (if accepting a callback)

appleJuice
2018-07-10 23:30:46

if i set route argument to simply route in stead of route = ' ', success but if I leave with default value, failed

appleJuice
2018-07-10 23:30:50

any help?

charlierudolph
2018-07-12 21:19:49

Hmm, thats very odd. I think that has to do with how the function is transpiled to javascript. Not much workaround aside from not using a default parameter. You could also use something like https://www.npmjs.com/package/util-arity to wrap your function in one that ha a specific length

npm
len
2018-07-13 09:56:18

Beside being a very interesting read https://eslint.org/blog/2018/07/postmortem-for-malicious-package-publishes Caused quite some noise at some offices this morning ^^

Be aware there's a timeslot you could've pulled this in locally when working on cucumber or other projects with eslint.

ESLint - Pluggable JavaScript linter
☠️ nEkis
nEkis
2018-07-16 02:32:29

*Thread Reply:* thanks for info

Liberty
2018-07-23 08:39:44

@Liberty has joined the channel

laxmi
2018-07-24 07:53:48

@laxmi has joined the channel

laxmi
2018-07-24 07:55:30

hey I am using protractor with cucumber

laxmi
2018-07-24 07:56:08

I want to execute one scenario with multiple test data

laxmi
2018-07-24 07:56:25

as for now I have 4 test data

laxmi
2018-07-24 07:57:18

when I am excuting this test its executing with top 3 test data but not with last one

Cat
2018-07-24 07:57:45

Can you provide an example of the test case?

laxmi
2018-07-24 08:01:56

I am not able copy and paste

laxmi
2018-07-24 08:02:05

I don't know why

Cat
2018-07-24 08:02:58

Ok… I can’t really help much without context

laxmi
2018-07-24 08:07:14

@laxmi uploaded a file: image.png

Cat
2018-07-24 08:08:14

That last line - is it separated by a break?

Cat
2018-07-24 08:08:38

If so, that is probably why it’s not running

laxmi
2018-07-24 08:09:29

what break i didnot get u

laxmi
2018-07-24 08:10:09

but test is passed but in UI i am not able to see

laxmi
2018-07-24 08:10:38

u r talking about space

laxmi
2018-07-24 08:10:56

no there is no space in my test

Cat
2018-07-24 08:11:02

a line break.

Cat
2018-07-24 08:11:05

not a space.

Cat
2018-07-24 08:11:17

spaces would be… ideal, actually because that would be readable but that’s a style thing 😛

laxmi
2018-07-24 08:11:48

can u highlight that line and send it to me back

Cat
2018-07-24 08:13:00

Account 4 (that last line of your code) is likely the issue

Cat
2018-07-24 08:13:33

Remove the line break between test data 3 and test data 4

laxmi
2018-07-24 08:14:21

that is what i am telling

laxmi
2018-07-24 08:14:54

there is no one line gap in my test

Cat
2018-07-24 08:15:04

It’s on the screenshot 🤷

Cat
2018-07-24 08:15:20

You said the first three were running and the fourth was not

Cat
2018-07-24 08:15:26

the fourth has a breakline between it and case 3

Cat
2018-07-24 08:15:34

according to your screenshot

Cat
2018-07-24 08:15:43

if the screenshot isn’t an accurate depiction of your code, there’s really not a whole lot I can do

laxmi
2018-07-24 08:17:46

Examples: |Account_search|URL| |SUZANNE CZARKOWSKI|xyz| |617-543-8719|xyz|
|8499100020187174|xyz| |8499100020187174|xyz|

laxmi
2018-07-24 08:17:55

this is my test data

Cat
2018-07-24 08:18:45

Why do you have two identical test cases?

laxmi
2018-07-24 08:18:59

so its not taking last one and my result is 4 scenarios are passed

laxmi
2018-07-24 08:19:15

actually first one is also same

Cat
2018-07-24 08:19:49

ok, what’s the output you’re getting when you run this?

laxmi
2018-07-24 08:21:19

i am not getting any error

laxmi
2018-07-24 08:22:22

while executing i can see my test with three different test data but not with fourth one

laxmi
2018-07-24 08:22:36

and test is passed

Cat
2018-07-24 08:23:00

If that’s the case, then it’s likely just related to the speed the tests are running at if you aren’t getting any errors at all

Cat
2018-07-24 08:23:22

Ideally, you want tests to run as fast as possible (which means watching the UI isn’t generally a goal unless you’re troubleshooting)

laxmi
2018-07-24 08:23:22

i am using cucumber version is 1.3.1

Cat
2018-07-24 08:23:46

It’s likely Protractor’s end, not cuke

Cat
2018-07-24 08:23:59

Cucumber doesn’t care about the UI - it’s just running the tests

laxmi
2018-07-24 08:24:16

so what i have to do

Cat
2018-07-24 08:24:48

If you absolutely, positively, MUST see each and every test case execute via UI? Add waits to your protractor scripts. It’d be poor design, but it’ll do the thing you want 🤷

laxmi
2018-07-24 08:25:51

ya with top 3 test data i can see each and every test step

Cat
2018-07-24 08:26:52

Unless cucumber is simply ignoring duplicate test cases (which iirc, it doesn’t do but I could be mistaken given that you’re using a much older version of cucumber), you’re likely just going to need to modify your protractor scripts if it HAS to be visible in the UI for some reason.

laxmi
2018-07-24 08:30:21

which version of cucumber is integrate with protractor

Cat
2018-07-24 08:31:10

If you’re using it with protractor, it’s obviously integrated…

Cat
2018-07-24 08:32:09

My comment was simply that I’m not as familiar with the older version because my stack uses the most recent.

Cat
2018-07-24 08:32:25

There could be differences in behavior that I’m unaware of since it’s a significantly older version of cucumber

Cat
2018-07-24 08:32:48

Although I would suggest not repeating test cases - you could try changing case 4 to a different data point to see if you can watch it

Cat
2018-07-24 08:32:50

easy way to verify

Cat
2018-07-24 08:33:01

plus makes for better tests since there’s usually not a good reason to duplicate test cases.

laxmi
2018-07-24 08:35:08

i am not using duplicate test data i ajust sent u a example one thats it

laxmi
2018-07-24 08:35:20

4 test data is different

laxmi
2018-07-24 08:35:56

one with name , phone number, account number, mail id

Cat
2018-07-24 08:36:53

|8499100020187174|xyz| |8499100020187174|xyz| … those are identical

Cat
2018-07-24 08:39:00

even if in your system, those represent two distinct values (e.g., mail id = abc and account number = abc - different key/value pairs but happen to have the same value), cucumber doesn’t know that. As far as it’s concerned, you’re just entering a string value.

Cat
2018-07-24 08:39:08

So just try plugging in a different valid value and see what happens

gopinathppm
2018-07-24 09:13:36

@gopinathppm has joined the channel

gopinathppm
2018-07-24 09:14:16

Hey Folks, hope all doing great...

Quick help, pls can anyone assist me to add IE11 into the wdio cucumber framework selenium standalone server - 3.4.0 node: 6.9 let me know if you need any more detail

Cat
2018-07-24 10:51:36

*Thread Reply:* What’s the issue precisely? are you unable to add the driver?

gopinathppm
2018-07-25 05:55:03

*Thread Reply:* thanks Cat for your response. I was facing issue while running test on IE11 . Issue has come up after adding driver as it was asking to add gecho.

Issue is resolved now. Thanks a lot:)

👍 Cat
karl.massam
2018-07-24 15:33:57

@karl.massam has joined the channel

nirmal
2018-07-25 10:56:02

@nirmal has joined the channel

suswari
2018-07-26 16:16:29

Hi Folks,

suswari
2018-07-26 16:17:05

Did anyone experience errors with webdriver-manager update command today

suswari
2018-07-26 16:17:44

The error I see is: $ webdriver-manager update events.js:160 throw er; // Unhandled ‘error’ event ^

Error: getaddrinfo ENOTFOUND selenium-release.storage.googleapis.com selenium-release.storage.googleapis.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

Chip
2018-07-30 13:36:55

I’ve been using this framework for testing some applications that use Angular as well as legacy applications. https://github.com/igniteram/protractor-cucumber-typescript

Stars
<p>104</p>
Language
<p>TypeScript</p>
Chip
2018-07-30 13:37:39

I’m about to start diving into ReactJS, and I wanted to check if anyone had any good suggestions for testing that, or if I should try to get it working with the framework I’m already familiar with.

Cat
2018-08-01 06:13:48

*Thread Reply:* I’d check out webdriverio since it’s framework agnostic 😉

iiicubed
2018-07-31 07:42:57

howdy y’all — i have a conundrum! I’m using Selenium and Cucumber to test a React app. the app subscribes to a websocket that notifies when data has been updated on the backend, so the client can initiate an AJAX call to an API to refresh the UI with latest data — and therein lies the problem

slackbot
2018-07-31 07:42:57

** https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool

cucumber.io
iiicubed
2018-07-31 07:44:34

this AJAX update is intermittent, unpredictable, and problematic. one of our steps opens a data filter, manipulates it, then applies the filter. but, if an external update is initiated mid-step, the UI refreshes, and the filter dropdown is closed — that step fails.

iiicubed
2018-07-31 07:46:01

i’d like to have a method to listen for the update, pause the current step, and continue/restart the current step once the update has completed — much like a conditional breakpoint on a debugger

iiicubed
2018-07-31 07:46:50

caveat(s): the websocket is protected by authentication, and cannot be snooped or sniffed to my knowledge

Raj
2018-08-02 00:31:38

@Raj has joined the channel

chrismarks
2018-08-06 23:58:59

@chrismarks has joined the channel

dtran
2018-08-09 12:04:53

@dtran has joined the channel

dtran
2018-08-09 12:07:54

Anyone able to get Webstorm and or Intellij to recognize step definitions in typescript?

J
2018-08-14 03:20:43

@J has joined the channel

Ayethin
2018-08-16 01:13:54

@Ayethin has joined the channel

dmshamonov
2018-08-16 07:50:50

Hi! Can you help me? On Ubuntu Server/nodejs 10.9.0 I start that test cucumber-js --require-module babel-core/register -f summary -f json:reports/cucumber_report.json --language ru features/test.feature and catch that error

(node:9711) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
TypeError: Cannot read property 'line' of undefined
    at Object.generateEvents (/home/test/api-bdd/node_modules/gherkin/lib/gherkin/generate_events.js:61:38)
    at /home/test/api-bdd/node_modules/cucumber/src/cli/helpers.js:53:26
    at Generator.next (&lt;anonymous&gt;)
    at Generator.tryCatcher (/home/test/api-bdd/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/home/test/api-bdd/node_modules/bluebird/js/release/generators.js:97:49)
    at /home/test/api-bdd/node_modules/bluebird/js/release/generators.js:201:15
    at getTestCases (/home/test/api-bdd/node_modules/cucumber/lib/cli/helpers.js:102:18)
    at /home/test/api-bdd/node_modules/cucumber/src/cli/helpers.js:32:13
    at Generator.next (&lt;anonymous&gt;)
    at Generator.tryCatcher (/home/test/api-bdd/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/home/test/api-bdd/node_modules/bluebird/js/release/generators.js:97:49)
    at Promise._settlePromise (/home/test/api-bdd/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/home/test/api-bdd/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/test/api-bdd/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/test/api-bdd/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/test/api-bdd/node_modules/bluebird/js/release/async.js:143:10)

But on my Mac I don't catch that error

dmshamonov
2018-08-16 21:22:36

It happening when I use option --language ru

dmshamonov
2018-08-16 21:45:49

I created issue about it https://github.com/cucumber/cucumber-js/issues/1117

DMShamonov (https://github.com/DMShamonov)
arjunjh10
2018-08-19 17:51:48

Hi, I was hoping if someone here can share with me an example of how to setup a debugger for CucumberJs when used with Typescript in VSCode. I cannot get it to work

Jay
2018-08-20 11:27:41

@Jay has joined the channel

Jay
2018-08-20 11:28:23

Hello all, are there any afterstep or beforestep blocks? I want to do something after eachstep, like collect data or take screenshot. I am using cucumber-js

Gem
2018-08-20 11:32:20

Sorry, changing the link.

Jay
2018-08-22 11:23:42

*Thread Reply:* I am not able to get it working...setting tags in the hooks is same as defining a tag. needs to be invoked by explicitly declaring the tag in the feature file.

Jay
2018-08-22 11:24:22

*Thread Reply:* After({ tags: 'not @deleteParticipant' },(scenario){//do something}

Gem
2018-08-22 11:39:44

*Thread Reply:* @Jay What's your end goal you're trying to solve for?

Jay
2018-08-22 11:44:54

*Thread Reply:* I have few After hooks with tags, as such

Before({tags:'@setup', async(){
//does something})

After({ tags: '@teardown' }, async () =&gt; {
//does something}

which is called in a feature file as such

@setup @teardown
Scenario: Do something

I also have an after hook with no tags, which runs after each scenario

After((scenario){//take screenshot}

I need to take a screenshot when a step fails in the scenario.

Jay
2018-08-22 11:47:16

*Thread Reply:* The above works great as long as i dont have the @teardown tag in the scenario. The screenshot is taken at the step it fails.

Jay
2018-08-22 11:48:02

*Thread Reply:* For scenarios that have the @teardown tag, the screenshot is taken at the end of tagged after hook, @teardown

Jay
2018-08-22 11:48:42

*Thread Reply:* What i am trying to do is to see if i can take the screenshot at the time of step failure, instead of scenario failure.

Gem
2018-08-22 12:13:21

*Thread Reply:* Ah, gotcha. I'm not sure the best way to navigate that. I do know that the scenario object that gets passed in to the hooks contains the info around what tags it has as well as its success/failure, so perhaps you could modify the hooks to instead perform actions based on particular tags?

Jay
2018-08-22 12:14:40

*Thread Reply:* Woah!! that's a great idea! let me give that a shot

Jay
2018-08-22 12:17:16

*Thread Reply:* now that i think about it..it might not work. The After hook with no tag runs after the complete scenario, including @teardown. I might be wrong, but will let you know 🙂

Gem
2018-08-22 13:39:42

*Thread Reply:* Good luck!

Gem
2018-08-22 13:39:53

*Thread Reply:* If a step fails, the after scenario should still run

Gem
2018-08-22 13:40:18

*Thread Reply:* You could just have your scenario.failed? check happen before teardown and theoretically be golden. 🙂

Jay
2018-08-23 07:41:35

*Thread Reply:* Thanks so much @Gem! i was able to find a solution using your suggestion.

Gem
2018-08-23 08:14:59

*Thread Reply:* Awesome! You're very welcome @Jay 😄

Gem
2018-08-23 08:15:08

*Thread Reply:* :cucumberbdd: :cucumberbdd: :cucumberbdd: :cucumberbdd:

Gem
2018-08-20 11:32:39

You may need to click the javascript tab at the top of the page.

Michael Jang
2018-08-20 12:10:16

@Michael Jang has joined the channel

Jay
2018-08-20 12:15:17

thanks @Gem, i am going to see if i can use this.

Gem
2018-08-20 12:15:40

You're welcome! Good luck!

Muto
2018-08-21 06:33:36

@Muto has joined the channel

slackbot
2018-08-21 06:34:48

This message was deleted.

Cat
2018-08-21 06:36:07

*Thread Reply:* The answer in here is the same answer as in #help

Cat
2018-08-21 06:37:09

*Thread Reply:* The first line of that link is literally “World is an isolated context for each scenario, exposed to the hooks and steps as this. ”

Muto
2018-08-21 06:37:10

*Thread Reply:* Sorry for duplicate, will delete this one. Thanks!

Jay
2018-08-29 11:18:09

Hello! Cucumber is Parallel, any good reading material on how to best implement this?

Gem
2018-08-29 11:21:30

Cucumber doesn't run in parallel and I would imagine that this is a specific choice that @Aslak Hellesøy and others made. There are tools out there that will help you accomplish concurrency, but you should probably look into what's prompting you to want to run in parallel first.

Gem
2018-08-29 11:23:31

If you've got long running scenarios, is it because you're possibly automating through a UI which is slow, or perhaps there are time saving steps available in your system not being used or can be built into your code to make things more testable? It's also worth looking into the scenarios you've written to see if they're testing too many things rather than very specific & concrete examples.

Jay
2018-08-29 11:27:26

Ahh ok, the application we are testing is quite big, most of the scenarios are pretty specific and concrete, but they add up very soon.

Jay
2018-08-29 11:28:04

@Gem off the top of your head, any tools you can recommend?

Gem
2018-08-29 11:29:16

For javascript, unfortunately, no, sorry!

Gem
2018-08-29 11:29:30

If I gave you anything, I'd just be googling it first. 😛

Jay
2018-08-29 11:30:18

hahah fair enough! My google quest begins..🤸‍♂️

👍 Gem
Gem
2018-08-29 11:30:26

Good luck!

arjunjh10
2018-08-29 11:32:40

You can get parallelism through node child process. I customised a script for my project to spawn cucumber child processes to target different browsers and platforms at the same time.

arjunjh10
2018-08-29 11:33:43

But its a tideous task and I would also suggest to do some research as to what’s the requirement at your end that you want to automate in Parallel

Jay
2018-08-29 11:34:57

@arjunjh10 Thank you! I will look into that. Was it tedious because it was a lot of setup or maintenance?

Jay
2018-08-29 11:37:00

if it was setup, i think it might be worth the effort. The application i am testing is in its infancy, but already big enough. Granted, we will be removing some of the scenarios as it grows, i still think having the testing run in parallel might be a good option

arjunjh10
2018-08-29 11:37:02

For someone who was new to the concept child processes, it was a bit of a learning curve. And also, parallelism brings about more maintenance and setup.. simple 1 process cucumber testing is like 3-4 step setup

Jay
2018-08-29 11:37:25

I see, got ya..

Gem
2018-08-29 11:37:58

@Jay How long does your suite currently take to run?

arjunjh10
2018-08-29 11:38:00

Ok, to be fair, in our case, when I say parallel, it means running same test on different platforms or browser configs at the same time..

arjunjh10
2018-08-29 11:38:25

Definition could vary, and you may wanna run different scenarios together …

Jay
2018-08-29 11:38:54

@Gem, the whole suite takes about an 1hr 30 mins

Gem
2018-08-29 11:39:02

Yikes!

Jay
2018-08-29 11:39:05

yup...

Gem
2018-08-29 11:39:11

Better than overnight, I suppose. 😛

Gem
2018-08-29 11:39:28

What parts of the process do you think you can speed up?

arjunjh10
2018-08-29 11:39:36

> the whole suite takes about an 1hr 30 mins oh wow.. thats lot of time

Gem
2018-08-29 11:39:46

What scenarios of yours take the longest and why do you think that is?

👆 arjunjh10, Cat
arjunjh10
2018-08-29 11:39:57

maybe do minimal and happy paths if its UI only.

Jay
2018-08-29 11:42:55

we have two suites that we run..smoke and regression. regression is done overnight and that's the one with 1.5hr run time. most of the time is because we are running against large data set, where we are expecting certain number of rows, depending on some business logic. this can be anywhere from 20-25 rows

Jay
2018-08-29 11:43:47

with 5-7 columns

Gem
2018-08-29 11:46:32

Ah, more detail surfaces! haha

Jay
2018-08-29 11:49:38

yeah...its borderline integration testing..lol

Cat
2018-08-29 12:10:56

In that case, I’d consider leveraging your own api to hit endpoints for the bulk of the data handling, that will allow you to speed up the UI testing itself. It also allows you to more easily isolate the components you’re testing.

👍 Gem, Jay, matt-SmartBear
Youssef
2018-08-30 04:29:48

@Youssef has joined the channel

Youssef
2018-08-30 04:29:52

Hi

👋 Ayethin
Youssef
2018-08-30 07:49:55

Does cucumber support running the tests programtically from Node.js without using the cli

Youssef
2018-08-30 07:50:25

I mean doing something like cucumber.runTest(myTest)

Youssef
2018-08-30 07:50:57

I want to run a test multiple times and each time change some configuration

Youssef
2018-08-30 07:51:12

is there a documentation for that?

Cat
2018-08-30 07:52:19

Let me check

Cat
2018-08-30 07:56:06

I’m not seeing explicit docs for running it in node, but we do it. Do I remember where I read that I could do this? No. 🤷

Cat
2018-08-30 07:56:14

anyways, you can just do it like so:

Cat
2018-08-30 08:01:21

We’ve also got a custom command line runner for the entire framework in here, but it’s not really relevant for this use-case in particular

Youssef
2018-09-04 07:25:40

*Thread Reply:* @Cat Hello again, is there a way I can tell cucumber not to process.exit

Cat
2018-09-04 07:31:42

*Thread Reply:* iirc, cucumber exits by default when the event loop has finished draining. I’ve not had a need to do this, so I’d suggest looking at the CLI code for this one

Youssef
2018-09-04 08:13:50

*Thread Reply:* Oh sorry I just had bug in the output 😥 it actually doesn't exit by itself. Thank you 😄

Cat
2018-09-04 08:17:12

*Thread Reply:* ooo, that’s odd! Your event loop may be hanging somewhere

Cat
2018-09-04 08:17:33

*Thread Reply:* may want to try why-is-node-running 🙂

Cat
2018-09-04 08:17:50

*Thread Reply:* (don’t laugh - I legit just used it this morning already for some weirdness I was seeing - turned out to be a Babel issue)

Youssef
2018-09-07 08:13:52

*Thread Reply:* Hi again, I'm using this and it's working great with all my requirements except that when I try to pass the --parallel option it gives me an error

Youssef
2018-09-07 08:14:10

*Thread Reply:* do you think it should work if we run the cucumber.Cli like this

Youssef
2018-09-07 08:14:28

*Thread Reply:* of course I checked that I don't have any writes to the console

Cat
2018-09-07 08:18:02

*Thread Reply:* keep in mind --parallel is experimental (if I recall correctly - one of the others may correct me on that)

Youssef
2018-09-07 08:20:51

*Thread Reply:* Yes it's mentioned in the doc that it's experimental

Cat
2018-08-30 08:02:57

That said: you’re still accessing the CLI fundamentally (it’s how you’re passing in your requirements, configs, etc), but those can be easily made dynamic so that you can quickly swap things out for distinct runs

Youssef
2018-08-30 08:03:44

Oh I see

Youssef
2018-08-30 08:03:59

I think I can achieve want I want with this

Youssef
2018-08-30 08:04:04

I'll try it out

Youssef
2018-08-30 08:04:06

thanks

Cat
2018-08-30 08:04:10

shouldn’t need to modify too much. lmk if I can help 🙂

👍 Youssef
Cat
2018-08-30 09:16:24

oh that’s not even the fancy part @Gem 😛

👍 Gem
Bhréin Brannick
2018-08-30 12:38:14

@Bhréin Brannick has joined the channel

igneel64
2018-09-03 06:04:30

@igneel64 has joined the channel

Anna Do
2018-09-04 06:52:47

@Anna Do has joined the channel

Harsh
2018-09-04 12:18:51

@Harsh has joined the channel

mikegfisher
2018-09-04 15:19:44

@mikegfisher has joined the channel

Rich Downie
2018-09-04 17:10:21

@Rich Downie has joined the channel

manoj
2018-09-05 00:23:46

@manoj has joined the channel

manoj
2018-09-05 00:24:01

Hi Team,

manoj
2018-09-05 00:25:18

I need your help in implementing BDD scritps for canvas based elements on the page

manoj
2018-09-05 00:25:42

is it possible to inspect canvas element using cucumber js api ?

manoj
2018-09-05 00:26:20

i was thinking to use xpath for canvas just like we do for other elements

manoj
2018-09-05 00:26:42

but i think canvas inspection tool is no more present in chrome browser

manoj
2018-09-05 00:27:04

so any help would be really appreciated

manoj
2018-09-05 00:27:07

🙂

Cat
2018-09-05 08:07:04

So: cucumber is a test runner, not a webdriver. You can’t use cucumber itself to inspect anything - cucumber is just running the tests

:cucumberbdd: Gem
🙏 Gem, manoj
🙌 Jay
Cat
2018-09-05 08:07:32

you’d need something like cypress or selenium to inspect elements

mikegfisher
2018-09-05 23:36:09

*Thread Reply:* Cypress is great! I use this (below) tool to combine these two amazing tools! https://github.com/TheBrainFamily/cypress-cucumber-preprocessor

Stars
<p>109</p>
Language
<p>JavaScript</p>
👍 Ayethin
💯 Cat
Ana
2018-09-05 09:02:58

@Ana has joined the channel

manoj
2018-09-07 05:19:25

@Cat: thanks, i will explore more on that

Youssef
2018-09-07 08:15:16

@Cat this is the error I get

Cat
2018-09-07 08:17:22

I need a little more context than that. What are you doing that causes that error?

Cat
2018-09-07 08:21:36

*Thread Reply:* I’m not able to dig into the stacktrace right now, but I’m wondering if the fact that you’re returning cucumberCli.run() may be causing some issues (I could be wrong - just a hunch based on glancing at the code)

Youssef
2018-09-07 08:26:23

*Thread Reply:* it returns a promise so I need to listen to it to know when the tests have ended

Youssef
2018-09-07 08:18:59

this is the whole file that runs cucumber

Jay
2018-09-10 12:05:13

scenario.attach not a function. Is scenario.attach available in JS?

charlierudolph
2018-09-10 20:38:28

See these docs for the latest way to attach: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md

👍 Jay
vadym romaniak
2018-09-11 01:24:15

Hi 👋 I am using cucumber v4. An exception thrown in BeforeAll hook crashes the whole run. Please advise, is there any event/handler available for this case? So if an exception takes place, I want to be notified of that, close other processes (configuration server, connection to remote report dashboard, etc.) and only after this to stop the run. Found similar issue (in relation to afterStep), though it was 2 years - https://github.com/cucumber/cucumber-js/issues/658. Guess, things have changed since that time. Any advise will be highly appreciated 🙂

floribon (https://github.com/floribon)
Comments
17
Jay
2018-09-11 06:02:04

@charlierudolph thankyou, this is really helpful!

charlierudolph
2018-09-12 08:40:26

@vadym romaniak can you share your code (just the hook) and the output?

vadym romaniak
2018-09-13 03:32:08

Hi @charlierudolph, please let me know if you need more details hook.js:

BeforeAll(async () =&gt; {
   throw 'Some error'; 
});

output:

[2018_09_05T15:35:30.833] [WARN] default - {"type":"pickle","uri":"features/smoke/login.feature","pickle":{...}}
[2018_09_05T15:35:30.835] [WARN] default - {"type":"pickle_accepted","pickle":{...},"uri":"features/smoke/login.feature"}
[2018-09-05T15:35:30.836] [WARN] default - {"type":"test_run_started"}
[2018_09_05T15:35:30.843] [ERROR] default - Unhandled rejection VError: a BeforeAll hook errored, process exiting: features/support/hooks.js:165: Some error
    at /Users/Documents/Projects/js/node_modules/cucumber/src/runtime/index.js:36:15
    at Generator.next (&lt;anonymous&gt;)
    at Generator.tryCatcher (/Users/Documents/Projects/js/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/Users/Documents/Projects/js/node_modules/bluebird/js/release/generators.js:97:49)
    at Promise._settlePromise (/Users/Documents/Projects/js/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/Users/Documents/Projects/js/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/Documents/Projects/js/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/Users/Documents/Projects/js/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/Documents/Projects/js/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/Documents/Projects/js/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/Users/Documents/Projects/js/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)

[2018-09-05T15:35:31.847] [WARN] default - [15:35:31] E/launcher - BUG: launcher exited with 1 tasks remaining
charlierudolph
2018-09-15 09:01:07

@vadym romaniak that is by design. If a before all hook fails, the entire suite can’t be run

charlierudolph
2018-09-15 09:01:49

I guess we can report the error without killing the suite

charlierudolph
2018-09-15 09:03:34

But no scenarios would be run. I’ll think on this a bit as this wasn’t put into the normal flow as we didn’t have a way to report a before all hook error

vadym romaniak
2018-09-16 23:59:44

@charlierudolph That would be great to have an error when before all hook fails. Should I open an issue? > I guess we can report the error without killing the suite

charlierudolph
2018-09-22 14:23:19

*Thread Reply:* Yes please

Jon Acker
2018-09-17 07:32:23

@Jon Acker has joined the channel

iiicubed
2018-09-17 09:43:06

howdy all! i am writing a custom task runner around Cucumber for Node, and i am wondering — when passing CLI parameters to a Node child_process.exec, does Cucumber need to have --parallel in a particular position?

Cat
2018-09-17 10:24:53

*Thread Reply:* Can you give an example of what you’re doing in particular? I don’t think it should need to be in a particular position

iiicubed
2018-09-17 10:25:49

*Thread Reply:* i am passing through additional command line variables to allow configuration by TeamCity of various test configurations

iiicubed
2018-09-17 10:26:02

*Thread Reply:* it seems --tags @prod will pass through

Cat
2018-09-17 10:26:40

*Thread Reply:* afaik, there’s no reason it would need to be passed in a particular order, or drop the params.

iiicubed
2018-09-17 10:26:45

*Thread Reply:* but a custom value — say --target dev is swallowed somewhere when --parallel 25 or whatever is provided

iiicubed
2018-09-17 12:15:21

*Thread Reply:* it only seems to be the ’--target` option. others pass through fine.

iiicubed
2018-09-17 09:43:44

i am noticing that other --params seem to be dropped when --parallel is included or not, but not sure what the order should be — or if it matters

Bhréin Brannick
2018-09-21 08:38:29

Hi Folks...I wonder is it possible to get all the test scenarios in a test run in the BeforeAll stage of the current test run with cucumber-js!?

Cat
2018-09-21 08:40:45

*Thread Reply:* What’s the use case?

Bhréin Brannick
2018-09-21 08:45:11

*Thread Reply:* Integration with Testcafe...I building off this project https://github.com/rquellh/testcafe-cucumber but I'd ideally like to move the setup to Testcafe to BeforeAll rather than Before stage

Stars
<p>29</p>
Language
<p>JavaScript</p>
Bhréin Brannick
2018-09-21 08:48:05

*Thread Reply:* Reason for moving to that stage is because setting up at Before for every test scenario is really slow

Bhréin Brannick
2018-09-21 08:50:36

*Thread Reply:* So prior to invoking test cafe I'd like to generate the same number of testcafe scripts as is in the current test run with cucumberjs

Bhréin Brannick
2018-09-21 08:50:52

*Thread Reply:* Hope that makes sense

Cat
2018-09-21 08:55:03

*Thread Reply:* I think I’ve got you (although haven’t worked w/testcafe so bear with me). I’m not sure if you could actually grab a list of scenarios going into the run you’re executing since BeforeAll() doesn’t have the same context readily available as Before() but I don’t see any reason you couldn’t set up a fairly straightforward file reader to do the trick.

Bhréin Brannick
2018-09-21 08:59:38

*Thread Reply:* I guess I could even use the gherkin library shipped with cucumber to get all the tests in a folder...it gets complicated tho if figuring out what tags were applied to the runner too & what tests not to generate... appreciate any pointers on the above

Cat
2018-09-21 09:02:14

*Thread Reply:* hm. Since you can’t access world context from there, perhaps something that captures the args you use at CL and filters the file matching that way?

Bhréin Brannick
2018-09-21 09:12:06

*Thread Reply:* I guess I could put the CL arguments into an environment variable & use it back at that stage...it does seem cumbersome tho 😔

Cat
2018-09-21 09:13:43

*Thread Reply:* a bit. There may be a more clever way to implement it but that’s significantly different than how I’ve been using the BeforeAll + AfterAll hooks so I don’t want to give some super-simple sounding answer if it’s not remotely helpful 😂

Bhréin Brannick
2018-09-21 09:16:39

*Thread Reply:* In any case it's defo not possible to get that info from BeforeAll...I know this isn't a typical use case but it's just to have integration with Testcafe

Bhréin Brannick
2018-09-21 09:58:56

*Thread Reply:* I notice this.result has some info within BeforeAll but doesn't return me all the feature files in that run

Cat
2018-09-21 10:05:09

*Thread Reply:* it’s not impossible to get it. It’s just a bit of heavy lifting 🙂

Bhréin Brannick
2018-09-21 10:10:07

*Thread Reply:* But by default from the framework cucumberjs it's a no!?

Cat
2018-09-21 10:19:29

*Thread Reply:* Correct. BeforeAll & AfterAll aren’t designed to have access to the world instance because they run before everything.

Karl
2018-10-12 11:33:39

@Karl has joined the channel

Youssef
2018-10-17 08:28:40

Hello nice people

Youssef
2018-10-17 08:28:59

is it possible to add some arguments to the step from the Before hook?

Youssef
2018-10-17 08:29:24

I see there is a key called arguments in step

Youssef
2018-10-17 08:29:45

but when I do step.arguments.push('Hello world!');

Cat
2018-10-17 08:29:58

What precisely are you trying to accomplish?

Youssef
2018-10-17 08:29:59

I get this error Error: Unknown argument type:'Hello world!'

Youssef
2018-10-17 08:30:39

I'm trying to read a string from the step definition

Youssef
2018-10-17 08:31:14

That $(banner: Banner with internal link) is stored in a file

Youssef
2018-10-17 08:31:32

and I want to read it from the file and then have as an argument

Cat
2018-10-17 08:32:28

Why not just write a helper function to pass the string from the file to the step?

Cat
2018-10-17 08:33:03

ahhh, I see

Cat
2018-10-17 08:33:13

What does your feature file look for in this use case?

Cat
2018-10-17 08:34:52

I suspect the way to go there would not be the before step, but instead passing it into the world instance

Youssef
2018-10-17 08:35:54

the world instance is for the whole scenario

Cat
2018-10-17 08:36:12

Right.

Youssef
2018-10-17 08:36:20

so how am I going to know inside the step what is the value for that step

Cat
2018-10-17 08:36:30

Because the world passes this to steps?

Cat
2018-10-17 08:36:41

(and Before/After hooks, fyi)

Youssef
2018-10-17 08:36:47

I know

Youssef
2018-10-17 08:37:04

but in the step I do this.selectors and I get an array of all those values

Youssef
2018-10-17 08:37:17

but which one is the one used for the current step

Youssef
2018-10-17 08:37:40

because there can be many steps that use similar values in the scenario

Youssef
2018-10-17 08:38:06

and a step doesn't always have the same position so I can't do this.selectors[1]

Cat
2018-10-17 08:38:44

There are a couple of different approaches you could use. Ideally, you’d just use the page object model but we aren’t always able to take the ideal route 🙂 In this case, I’d write a helper to pass in the file values (either into the world or into steps themselves if needed, depending on limitations) and then match the value you use in the feature file

Youssef
2018-10-17 08:39:35

Ah I see

Cat
2018-10-17 08:39:44

And you’re right, this.selectors[1] would be a super fragile approach.

Youssef
2018-10-17 08:39:49

yeah a helper could work

Youssef
2018-10-17 08:40:15

I just wanted to know if I coudln't pass it in the arguments so that the other devs don't have to call it each time

Cat
2018-10-17 08:40:44

I wouldn’t pass it in step args - I’d pass it in step helpers or as a before setup step

Youssef
2018-10-17 08:41:04

Because I see there is an arguments array so I thought that was the solution

Youssef
2018-10-17 08:41:28

this is in the before step btw

Cat
2018-10-17 08:41:34

Right, you’d mentioned 🙂

Cat
2018-10-17 08:43:22

Yeah, I think in this case, a helper is prob your best friend 🙂 Even if you leverage it as part of a Before hook, it’ll allow you to more easily destructure and manipulate the data faster/more efficiently

Cat
2018-10-17 08:43:35

(also scales soooo much better longterm)

Youssef
2018-10-17 08:44:06

Yes but how would I pass the result to each step

Cat
2018-10-17 08:46:43

Hm. Trying to figure out the best way to explain without sending you a bunch of code 🤔

Cat
2018-10-17 08:47:27

ok, so, we have a factory class (we’ll just call it Factory for now) where we can initialize page objects and less page-specific functionality

Cat
2018-10-17 08:52:41

so if we have a helper where we want to ensure the context remains consistent so that if I have a step that needs to be something akin to return this.client.waitForVisible(this.myElement); and if I want to read in that file so that I can grab whatever’s mapped to this.myElement

Cat
2018-10-17 08:52:54

(sorry, doing this while working in a completely different part of codebase so bear with me for slowness)

Cat
2018-10-17 09:07:20

This is a suuuuuper high level explanation but this would allow you to pass it through to your steps so if you had a step where the def was return this.driver.waitForVisible(this.elements.elementName); (or possibly this.elementName depending on how you destructure etc.

Youssef
2018-10-17 09:36:07

this is the world instance and elements is all the elements in the scenario but how could I know which one is the element in the current step

Youssef
2018-10-17 09:37:11

it's ok if it's not possible I'll just use a helper function

Cat
2018-10-17 10:14:36

because if you’ve made this.elements (which is the base object of your file import - let’s assume for the sake of this hypothetical that this is, say, a JSON object - something like { elementName : elementSelector, myButton : .button-class, etc.} you would be able to access this.elements.myButton

Cat
2018-10-17 10:14:40

within your step def

noMoreMutants
2018-10-19 13:30:22

@noMoreMutants has joined the channel

noMoreMutants
2018-10-19 13:32:10

Hi Guys, I need help. I have a protractor-cucumber-framework. Whenever I run my feature files I get an Undefined. Implement with the following snippet. I have given proper paths to stepDefs. I'm not sure why this is happening

Cat
2018-10-21 13:06:56

*Thread Reply:* I’d need to see your stacktrace to help

Cat
2018-10-21 13:07:12

*Thread Reply:* as well as the details of your config

noMoreMutants
2018-12-10 15:32:50

*Thread Reply:* @Cat Hi Cat, I just saw this reply after logging in after some time. Thank you for replying, although I got a co-worker's help to figure this out. But again, thanks for volunteering to help

slackbot
2018-10-19 13:32:10

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

noMoreMutants
2018-10-19 13:36:10

@mpkorstanje

mpkorstanje
2018-10-19 15:18:52

I don't know much about cucumber JS. But maybe Cat can help you out. She knows more about it then I do.

banavathu
2018-10-20 08:51:08

@banavathu has joined the channel

banavathu
2018-10-20 08:51:27

Hi folks

banavathu
2018-10-20 08:51:44

need help on cucumber JS

banavathu
2018-10-20 08:52:02

how to get snapshot for every step

Cat
2018-10-21 13:07:23

*Thread Reply:* Cucumber doesn’t capture screenshots. Your webdriver does that.

Cat
2018-10-21 13:08:17

*Thread Reply:* If you want a screencap at every step, you could just wrap it so that screencap happens after promise is fulfilled by the test step

matt-SmartBear
2018-10-24 15:04:55

*Thread Reply:* some discussion here: https://github.com/cucumber/cucumber-js/issues/997]

matt-SmartBear
2018-10-24 15:05:03

*Thread Reply:* there are no afterstep hooks AFAIK

Cat
2018-10-25 06:25:55

*Thread Reply:* ^^ correct. That’s why I was thinking perhaps wrapping the steps themselves (perhaps at defineStep?) as promises and capturing the screenshot when they resolve would do

matt-SmartBear
2018-10-27 15:46:01

*Thread Reply:* yeah nice idea @Cat that seems plausible!

Cat
2018-10-29 06:42:30

*Thread Reply:* Sometimes I know things, bringing it to a total of like 8 things I know! 😄

🎉 Gem
Andrew Rohling
2018-10-26 20:06:16

@Andrew Rohling has joined the channel

Anna Do
2018-10-30 08:11:38

@Anna Do has left the channel

olleolleolle
2018-11-12 11:16:10

@olleolleolle has joined the channel

olleolleolle
2018-11-12 11:20:48

Hi, friends! I’m going to dive into using EmberJS with cucumber. Did you try that? Let’s talk about that.

olleolleolle
2018-11-12 11:21:10

*Thread Reply:* Currently sniffing at https://www.npmjs.com/package/ember-cli-yadda

npm
olleolleolle
2018-11-12 11:23:48

*Thread Reply:* I’m also writing Ruby, and tests run there, as well, so it could be something along these lines: http://trianglegrrl.github.io/ember-cucumber-pres/#/

trianglegrrl.github.io
Gem
2018-11-12 14:25:58

*Thread Reply:* Why are you breaking things @olleolleolle? 😛

Gem
2018-11-12 14:26:06

*Thread Reply:* (I've got no meaningful input here, sorry!)

Karl
2018-11-19 09:30:09

*Thread Reply:* I’ve got nothing much to add, but just wanted to chime in that we use Ember and dig Cucumber, too (though we don’t use Cucumber with Ember at the moment)

👍 olleolleolle
Andy Nguyen
2018-11-13 20:01:43

@Andy Nguyen has joined the channel

Andy Nguyen
2018-11-13 20:15:41

I am trying to get cucumber.js working on a Create React App. Are there any guides or example projects that can lead me in the correct direction?

Cat
2018-11-14 06:40:59

*Thread Reply:* How it works on a Create React App is going to be the same way it works on any other app. Cucumber doesn’t care about your framework 🤷 What is the exact problem you’re trying to solve?

Andy Nguyen
2018-11-14 07:42:12

*Thread Reply:* The problem my team is facing is using react components with the stepdefs.js file. When we run the cucumber tests, we get an unexpected identifier at “import React, { Component } from ‘react’”;

Andy Nguyen
2018-11-14 07:42:33

*Thread Reply:* This import is located on the React component, we are testing. (Apologies for the lack of information, on my phone).

Cat
2018-11-14 07:58:06

*Thread Reply:* ok, when you’re on your machine, ping me and send some of the code (sanitize it if you need to) for how you’re attempting to initialize the tests and access the app

Andy Nguyen
2018-11-20 05:12:34

*Thread Reply:* Ping! The issue we were having is we weren't transpiling ES6 Imports and React JSX. The issue was solved by using the following NPM packages: @babel/core, @babel/cli, @babel/preset-env, and @babel/preset-react. We are still having issues using React CSS imports (Node doesn't like the CSS syntax), ~but taking out those imports allow us to test for now~. EDIT: We got CSS to work too! For every component under test, you have to check if the component is being used in the browser or the server. If it is being run in the browser, "require" the CSS files. It if is being run in the server. do not "require" the CSS files.

Cat
2018-11-20 15:08:29

*Thread Reply:* hm. You should be able to get around that by leveraging babel runtime or modifying where you’re introducing babel to the project. That would enable you to keep the code consistent throughout

TVlasev
2018-12-19 06:00:30

*Thread Reply:* Hi @Andy Nguyen I have the same problem and I've install the packages that you mentioned, but still no result. Still getting the "import React from 'react'" error. I've tried to import all things with require and it works, but then it doesn't recognize the JSX syntax, because I'm using shallow from enzyme. Do you have any idea how I can solve this problem. Thanks

Andy Nguyen
2018-12-19 06:02:04

*Thread Reply:* We are also using enzyme, so that shouldn’t be the issue.

TVlasev
2018-12-19 06:07:05

*Thread Reply:* Can you show me some example, or article how to setup all together and use it, I will be very thankful

Cat
2018-12-19 06:26:40

*Thread Reply:* I’d just look at the babel.io docs. They’re pretty thorough re: setup and config docs.

Andy Nguyen
2018-12-19 07:33:01

*Thread Reply:* Did you transpire with Babel @TVlasev

Andy Nguyen
2018-12-19 19:25:04

*Thread Reply:* @TVlasev I made a tutorial and example project of how to configure Cucumber, Enzyme, and Create React App. Hopefully having this example project and tutorial will encourage more people to use Cucumber with React. Let me know, if this helps you https://github.com/NguyenAndrew/Enzyme-Cucumber-React

Language
<p>JavaScript</p>
Last updated
<p>3 minutes ago</p>
👍 TVlasev
TVlasev
2018-12-20 00:11:31

*Thread Reply:* @Andy Nguyen Great repository, looks really good, I'll try it out and let you know if helps, thank you for the effort

TVlasev
2018-12-20 01:32:58

*Thread Reply:* @Andy Nguyen It's working, it's great repository, I'll spread the word, hope more people will use it, thank you! Just one more question: If we have a normal tests with jest and enzyme and we want to run them too, i guess i can just add "react-scripts test", like that: "test": " react-scripts test && npm run babel-src && npm run babel-test && npm run cucumber-test" ?

👍 Andy Nguyen
Andy Nguyen
2018-12-20 03:30:32

*Thread Reply:* @TVlasev Yes, that should work as the create react app was not ejected.

TVlasev
2018-12-20 05:10:57

*Thread Reply:* @Andy Nguyen Just like suggestion in FAQ / Troubleshooting section you can include what to do if css files throws an error and how and where to include them.

Andy Nguyen
2018-12-20 05:35:08

*Thread Reply:* @TVlasev Ah thank you for the suggestion. I am hesitant on adding the Jest react-scripts question to the FAQ, because it is more of a “How do I use npm?” question rather than “How can I integrate Cucumber, Enzyme, and Create React App?”. Another reason: Cucumber plays very with many different testing frameworks, so I am trying to keep the tutorial focused. Maybe I will make an other questions page?

TVlasev
2018-12-20 05:52:00

*Thread Reply:* @Andy Nguyen maybe i did't express myself well, sry for the bad english 😄 If we use a css file in a component when we run npm test, it gives this error: Unexpected token . Copy\transpiled\style\style.css:1 (function (exports, require, module, _filename, _dirname) { .search-bar { I think it's related to the subject, because if we use a imported css file in the component we can't test the component because the error. Node doesn't understand css syntax. Correct me here if I'm wrong

👍 Andy Nguyen
Andy Nguyen
2018-12-20 06:12:18

*Thread Reply:* @TVlasev That question is in the FAQ of the repo: "I have a Syntax error: (function (exports, require, module, _filename, _dirname) { .App {

SyntaxError: Unexpected token ."

Andy Nguyen
2018-12-20 06:13:05

*Thread Reply:* You should be able to ctrl+f that question, as example code is provided below the answer to solve that issue. Let me know, if you still have problems.

TVlasev
2018-12-20 06:46:20

*Thread Reply:* @Andy Nguyen ohhh, I'm sorry, i saw it. But still gives me the error when I use a css selector on JSX element. In src/ folder I have a style/ folder with style.css file in it. And I do the import with "import: ../../transpiled/style/style.css" in stepdefs.js file but still gives the same error.

Andy Nguyen
2018-12-20 07:19:09

*Thread Reply:* @TVlasev I am confused on this part: "And I do the import with "import: ../../transpiled/style/style.css" in stepdefs.js file" Can you clarify on what functionality you are testing when you import the CSS into your stepdefs? From my experience, you import/require the CSS into the corresponding react component (checking if the dom exists like you read in the FAQ), and the stepdefs.js would import the react component,

TVlasev
2018-12-20 07:37:00

*Thread Reply:* @Andy Nguyen Now i get it.. I've deleted the canUseDom func... 😄 now everything is ok.. sorry for this. Thank you again for your time

Andy Nguyen
2018-12-20 07:39:17

*Thread Reply:* @TVlasev 😄 Alright. Interesting that deleting the canUseDom functionality solved your problem. You are welcome

TVlasev
2018-12-20 07:41:57

*Thread Reply:* @Andy Nguyen no, no I've deleted it by mistake, after I added it back everything was OK 😄 Sry again for the english 😄

Andy Nguyen
2018-12-20 07:43:14

*Thread Reply:* @TVlasev Good to know. Glad you solved the problem!

👍 TVlasev
Andy Nguyen
2018-12-21 19:54:15

*Thread Reply:* Cat's advice led me to an awesome discovery, which should be beneficial to all React Cucumber developers (Unit Tests with no drawbacks, no rearranging of the step_definitions folder, and no transpiled folders). ~I opened an enhancement ticket on the tutorial project~ Enhancements have been implemented!

NguyenAndrew (https://github.com/NguyenAndrew)
Assignees
NguyenAndrew
Labels
enhancement, good first issue
👏 Cat
Andy Nguyen
2018-12-22 00:07:31

*Thread Reply:* @TVlasev I have implemented major improvements in the tutorial that improves the developer experience when using Cucumber with React. I would recommend updating your project to use them.

Omar
2018-11-14 11:43:15

@Omar has joined the channel

Tony Semana
2018-11-22 13:44:07

@Tony Semana has joined the channel

Andrew Peacock
2018-11-22 13:49:49

@Andrew Peacock has joined the channel

Christian Hujer
2018-11-27 02:52:48

@Christian Hujer has joined the channel

Kostas
2018-12-04 08:48:50

Hi peeps, Wonder if anyone could help with the following. When my cucumber script runs and it doesn't find any tests for the tag that I am using it returns a SUCCESS result, which could potentially result to false positives. How can I make it fail for such a scenario? 16:44:50 + node ./node_modules/cucumber/bin/cucumber-js ./test/features/ --format ./node_modules/cucumber-pretty --strict -t @testtag 16:44:51 0 scenarios 16:44:51 0 steps 16:44:51 0m00.000s 16:44:51 Finished: SUCCESS

Andrew Peacock
2018-12-04 19:00:10

@Kostas I believe I’ve seen similar problems using ant when invoking cucumber for a feature file that does not exist

Edison
2018-12-05 09:44:34

@Edison has joined the channel

Edison
2018-12-05 09:52:58

@Cat am new to cucumber js. Is it possible can please share some samples project with google navigation and click search operation with selenium web driver ?

Cat
2018-12-05 09:59:02

*Thread Reply:* I don’t have any samples off hand. what in particular are you having trouble with? the cucumber setup docs are pretty straightforward 🙂

Jay
2018-12-06 06:55:56

Hello Cuckes!

Is there beforeAll and AfterAll hook available? If so how do i invoke this?

This is my code

const BeforeAll = require('cucumber')
BeforeAll(async () =&gt; {
//steps
})
🥒 Karl
Cat
2018-12-06 07:13:55

*Thread Reply:* I’m mid-meeting so can’t look it up rn, but I believe it’s just Before and BeforeEach

Jay
2018-12-06 07:30:52

*Thread Reply:* Thank you for taking time to reply. 🙂

is there a better way/strategy to do a "setup" before any scenario runs?

Cat
2018-12-06 07:39:39

*Thread Reply:* Hm. I would say it depends on precisely what you’re needing to do.

Jay
2018-12-06 07:48:15

*Thread Reply:* @Cat so dumb of me..I put all my steps for data setup in before hook. This runs before any of the scenarios runs. not sure if this is the most efficient.

I am not sure if it runs before every single scenario

Jay
2018-12-06 07:50:05

*Thread Reply:* I do know if its a tagged hook, it will only run when called in a feature file. a general Before hook i am guessing will run before every scenario. Testing this theory..

Cat
2018-12-06 08:52:48

*Thread Reply:* hm. So, ymmv because how one automates one piece of software may vary wildly from the next, but for me, I find it helps to do data setup as part of the specific feature or scenario - usually in the Background steps. Now, there are some things that are more generic (for example: if you want to log in via API and get cookies - that’s likely something that applies to a ton of your tests and you can just do that as a before hook and pass the cookie values through there)

Cat
2018-12-06 08:53:04

*Thread Reply:* But again, that is going to vary greatly depending on the how and why 🙂

Cat
2018-12-06 08:53:18

*Thread Reply:* there are definitely cases where handling the data setup is completely legit in the Before hook

Cat
2018-12-06 08:53:45

*Thread Reply:* or it may be that some of the data setup should be in the Before hook, but other pieces need to be done only before tests with specific tags, etc

Jay
2018-12-06 09:00:26

*Thread Reply:* That's exactly what i intended to do with the data setup(maybe data setup is not the right word here). There are some reference data, that are constant that are needed as a pre-req, i am using API calls to prepopulate them. Ther are also other data setup that are specific to a feature file which are done via background. And lastly there are ones which need some, random data to be created, these are done with tagged hooks.

Jay
2018-12-06 09:01:53

*Thread Reply:* Thanks again @Cat, helps when you think aloud.

Cat
2018-12-06 09:04:25

*Thread Reply:* np! 🙂

Jay
2018-12-06 06:56:12

i am getting an error Unhandled rejection TypeError: BeforeAll is not a function

DeiDei
2018-12-06 18:11:15

@DeiDei has joined the channel

Marijana Rukavina
2018-12-12 08:04:30

@Marijana Rukavina has joined the channel

Marijana Rukavina
2018-12-12 08:05:59

Hello people 🙂 I have a question regarding cucumber.js. I hope this is the right place to ask it 😛 So, Is it possible to get currently executed test tag in beforeScenario function? If it is possible how to do it? 😄 Here is the link on stackoverflow where I asked the question https://stackoverflow.com/questions/53729101/cucumber-how-to-get-scenario-tag-that-is-currently-being-executed but with no luck yet for answers 😁

Stack Overflow
Cat
2018-12-12 08:34:29

*Thread Reply:* Hm, are you using straight cucumber-js or are you using wdio-cucumber?

Marijana Rukavina
2018-12-12 08:36:16

*Thread Reply:* I'm using wdio-cucumber-framework 0.1.0

Cat
2018-12-12 08:38:21

*Thread Reply:* Hm. that’s quite an old version. 🤔 That may be part of why you’re having difficulty. I want to say a few things have changed about how tags are fed in as far as where they’re available to reference, so I wouldn’t easily be able to answer that straight off

Cat
2018-12-12 08:39:37

*Thread Reply:* tbh, I’d start first with just playing around with console.log to see if you can just get it to log the tags and go from there.

Marijana Rukavina
2018-12-12 08:40:38

*Thread Reply:* yeah, it's like that on the project I'm currently working on and upgrading the version is not an option at the moment 😞

Marijana Rukavina
2018-12-12 08:42:17

*Thread Reply:* I can get the scenario tags by this: beforeScenario: function (scenario) { tags = scenario.getTags(); tags.forEach(function (scenarioTagItem) { ... }); }

Marijana Rukavina
2018-12-12 08:43:13

*Thread Reply:* but what I can't figure out is how to address/catch the tag of the test that is currently being under execution.

Cat
2018-12-12 08:45:27

*Thread Reply:* Hm. That I probably can’t help much with until I have some time to play with a test project

Marijana Rukavina
2018-12-12 08:45:30

*Thread Reply:* So for example, I have scenario with multiple tags, but conf.js file only running certain tag @registration and I want to catch that this scenario is being run under that tag => I know what are all tags which with scenario is tagged, but how do I catch the active one

Cat
2018-12-12 08:48:34

*Thread Reply:* Hm. Since it’s an older version and I’m just guessing here, I don’t want to point you in the wrong direction, but what happens when you try to reference something along the lines of this.scenario? Are you able to access tags that way?

Marijana Rukavina
2018-12-12 08:54:16

*Thread Reply:* when I do <a href="http://logger.info">logger.info</a>("XXX scenario " + scenario.toString()); I get info: XXX scenario [object Object]

Marijana Rukavina
2018-12-12 08:54:42

*Thread Reply:* how can I see all properties of that object

Cat
2018-12-12 08:55:04

*Thread Reply:* ahhhh

Cat
2018-12-12 08:55:26

*Thread Reply:* do JSON stringify instead of toString

Marijana Rukavina
2018-12-12 09:04:09

*Thread Reply:* when I do <a href="http://logger.info">logger.info</a>("XXX scenario " + JSON.stringify(scenario)); I get info: XXX scenario {}

Marijana Rukavina
2018-12-12 09:04:47

*Thread Reply:* 🤨

Marijana Rukavina
2018-12-12 09:04:54

*Thread Reply:* 😛

Cat
2018-12-12 09:06:53

*Thread Reply:* hm. 🤔

Marijana Rukavina
2018-12-12 09:08:38

*Thread Reply:* I have in conf.js file this among some other things:

Marijana Rukavina
2018-12-12 09:08:40

*Thread Reply:* before: function () { const chai = require('chai'); global.expect = chai.expect; global.should = chai.should(); global.logger = require('winston'); global.i18n = i18n;

    browser.setViewportSize({width: 1200, height: 1057})

}
Marijana Rukavina
2018-12-12 09:09:07

*Thread Reply:* so I guess it is using winston for logging purposes

Cat
2018-12-12 09:09:48

*Thread Reply:* yes, sounds like - try just console.log instead and lmk what you get

Marijana Rukavina
2018-12-12 09:13:17

*Thread Reply:* console.log("XXX scenario " + JSON.stringify(scenario)); => Still the same XXX scenario {} 😞

Marijana Rukavina
2018-12-12 09:13:33

*Thread Reply:* I don't get it

Marijana Rukavina
2018-12-12 09:13:49

*Thread Reply:* 😢

Marijana Rukavina
2018-12-12 09:13:58

*Thread Reply:* 😁

Cat
2018-12-12 09:14:49

*Thread Reply:* Hm. that is odd. I’m afraid I’m not gonna be much help on this until I have some time to poke around with that version

Marijana Rukavina
2018-12-12 09:15:14

*Thread Reply:* ok, cool, thanks a lot for your time 😘

Cat
2018-12-12 09:16:18

*Thread Reply:* np!

Cat
2018-12-12 09:17:10

*Thread Reply:* getting stuck with older versions is always difficult 🙂 to attempt to point you in the right direction - I’d keep playing around with that object and see if there’s anyway to successfully destructure it and get more info on what’s (supposed to be) in it

Marijana Rukavina
2018-12-12 13:12:38

*Thread Reply:* thanks for the advice 😉

Marijana Rukavina
2018-12-12 13:13:33

*Thread Reply:* I managed to debug it and searched with offered options that were there, but I think none of it will help me

Cat
2018-12-12 13:15:22

*Thread Reply:* bleh. Sorry.

Marijana Rukavina
2018-12-12 13:15:30

*Thread Reply:* What I really need is a a way to get the tags from configuration file main.conf.js that are set in the attribute:

cucumberOpts: {
    tags: ['@registration', '~@WIP']
}

in function beforeScenario?

Marijana Rukavina
2018-12-12 13:16:32

*Thread Reply:* not the ones that are actually on the scenario itself

Marijana Rukavina
2018-12-12 13:17:04

*Thread Reply:* and all of these are actually getting those tag that are on actual scenarios

Marijana Rukavina
2018-12-12 14:22:13

*Thread Reply:* I did it :nyanparrot: it was stupid => just called this.cucumberOpts.tags because it was in the same file and build my logic further on that

Marijana Rukavina
2018-12-12 14:22:51

*Thread Reply:* but thank you again for you time and help, I really appreciate it 🤗

Andrew Peacock
2018-12-12 16:33:16

*Thread Reply:* Just curious - what’s the need for retrieving tags at run-time ?

Marijana Rukavina
2019-01-02 10:27:05

*Thread Reply:* I have multiple profiles in wdio for different purposes (in this specific case countries) and I needed logic to know for which country did tests run @fr , @uk and so on @Andrew Peacock

Chfw
2018-12-15 01:12:09

@Chfw has joined the channel

TVlasev
2018-12-19 05:55:20

@TVlasev has joined the channel

mlvandijk
2019-01-05 07:56:29

@mlvandijk has joined the channel

Michael L.
2019-01-08 00:13:12

@Michael L. has joined the channel

mlvandijk
2019-01-10 10:57:39

Hi everyone, is anyone here able to review a small JavaScript example to add to the docs? https://github.com/cucumber/docs.cucumber.io/pull/287

TomerPacific (https://github.com/TomerPacific)
Comments
1
✋ Cat
Andy Nguyen
2019-01-10 22:15:04

*Thread Reply:* I am not a "reviewer", but I did take a look and made some comments.

mlvandijk
2019-01-10 22:26:51

*Thread Reply:* You're a reviewer now @Andy Nguyen :) Thanks!

👍 Andy Nguyen
Andy Nguyen
2019-01-12 13:13:53

*Thread Reply:* @mlvandijk The pull request is ready to be merged.

mlvandijk
2019-01-12 22:27:21

*Thread Reply:* Thanks for your help @Andy Nguyen :)

mlvandijk
2019-01-12 22:27:42

*Thread Reply:* Please stop by the docs anytime to improve the javascript side of things ;)

👍 Andy Nguyen
tooky
2019-01-11 01:28:21

@tooky has joined the channel

👋 Gem
Gem
2019-01-17 20:12:21

How are formatters used in cucumber-js? (specifically how do I specify junit?)

Gem
2019-01-17 20:13:40

Oh, I have to use a different package perhaps?

Gem
2019-01-17 20:16:02

Looks like that's the ticket.

Cat
2019-01-18 06:35:11

@Gem there are a few different ways to do it, iirc (been a few months since I set up the formatters on the newer project)

👍 Gem
Gem
2019-01-18 10:04:56

Ended up with cucumber-js --format=json | cucumber-junit &gt; junit.xml

👍 Cat, Andy Nguyen
Gem
2019-01-18 10:05:05

Not super into it, but so be it. 😛

Gem
2019-01-18 10:05:17

Dunno why cucumber-js doesn't have it built in like Ruby does

Cat
2019-01-18 10:20:47

to accommodate whatever the next new-hotness is, most likely 😛

Gem
2019-01-19 19:22:59

Anyone who's familiar with bash, piping, and whatnot, able to modify my command above so that the exit code from cucumber is still returned to the terminal running it? Right now, if anything fails, the code isn't returned so CircleCI doesn't think anything's wrong.

Cat
2019-01-22 05:37:11

*Thread Reply:* i’ve got something for this, hang on

Cat
2019-01-22 05:37:40

*Thread Reply:* ```export default async function run () { const cucumberCli = new cucumber.Cli({ argv: execArgs, cwd: process.cwd(), stdout: process.stdout });

var cliRun = await cucumberCli.run();
process.exit(cliRun.success ? 0 : 1);

}```

Cat
2019-01-22 05:38:09

*Thread Reply:* roughly what you’re looking for?

Cat
2019-01-22 05:38:46

*Thread Reply:* also I’m catching up and just realized this was from 1/19

Cat
2019-01-22 05:38:48

*Thread Reply:* 🙃

Gem
2019-01-22 09:58:10

*Thread Reply:* Hah!

Gem
2019-01-22 09:59:34

*Thread Reply:* Since the junit formatter requires piping the output the exit code being returned to Circle was for formatter which always passed, so Circle thought the Cukes were always passing, too

Andy Nguyen
2019-01-20 08:05:56

I have not solved this problem before, but maybe this will help @Gem https://stackoverflow.com/questions/1221833/pipe-output-and-capture-exit-status-in-bash

Stack Overflow
Gem
2019-01-20 09:18:39

Oh hey, thanks @Andy Nguyen! That may be just what I need.

Andy Nguyen
2019-01-20 09:27:29

No problem js! Let me know what you end up using, as my team might encounter the same problem in the near future.

Gem
2019-01-22 09:56:31

*Thread Reply:* I couldn't get it working and didn't want did want to bash my head against it so decided to switch to Ruby. 😛

😅 Andy Nguyen
Gem
2019-01-22 09:56:43

*Thread Reply:* That presented its own problems though

Charlie
2019-01-21 15:24:46

@Charlie has joined the channel

Andrew
2019-01-21 16:32:42

@Andrew has joined the channel

Andrew
2019-01-21 16:35:39

Hey all, I was just wondering what the best practice is sharing variables across multiple steps (in the same spec file). E.g In one step I call a click() method on some page object, which returns another page object (if the operation is successful). Then I want to access this newly instantiated object in another step to call some other methods on it.

Andrew
2019-01-21 16:36:01

I looked into the World object on the docs but I wasn't able to figure out how to use it

Andrew
2019-01-21 17:02:13

To clarify, the second step would be in the same test scenario as the first one

Andy Nguyen
2019-01-21 17:11:38

@Andrew If you want to share variables between steps, store the variable in 'this'. For example, Given('...' function() { this.variableThatYouNeedToShareBetweenSteps = ... }); When('...' function() { this.variableThatYouNeedToShareBetweenSteps.doDomethingWithThisVariableInAnotherStep(); });

👍 Gem
Andy Nguyen
2019-01-21 17:13:23

Definitely go through this tutorial https://docs.cucumber.io/guides/10-minute-tutorial/, if you haven't touched Cucumber.js before

Andrew
2019-01-21 17:49:43

Thanks for this ! In terms of 'best practice', which of the two following methods do you think is better? Say I have a 'Main Modal', that has a button that will open up a 'Sub Modal'. Currently, I have created ES6 class based page objects for both modals and I am storing a reference to the Sub Modal in the Main Modal like so

// using typescript 
class MainModal {
    // Sub Modal page object
    public subModal: SubModal
    // button has been abstracted into a 'Button' page object to encapsulate its functionality
    public button: Button
    constructor() {
        this.subModal = new SubModal();
    }

    public openSubModal(): Promise&lt;void&gt; {
        //click is a custom method in Button class
        return await this.button.click();
    }

    // rest ommitted
}

So in my spec file I have something like this

const mainModal = new MainModal();
When("the user opens the sub modal", async () =&gt; {
    await mainModal.openSubModal();
});

When("the user does something in the submodal", async () =&gt; {
    await mainModal.subModal.doSomething(); 
});

The problem with this is that I end up with lots of nested page objects so method calls end up being extremely long.

Would it be better to make the openModal() return the SubModal page object like this, save it into the 'World' object, and then access it in the next step. Are there any potential problems to watch out for when introducing dependencies between steps?

When("the user opens the sub modal", async () =&gt; {
    this.subModal = await mainModal.openModal();
});

When("the user does something in the submodal", async () =&gt; {
    await this.subModal.doSomething();
});
Andy Nguyen
2019-01-21 19:10:59

First, look at this page to see how to use promises with Cucumber.js https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md. Notice that instead of doing async/await, you return the promise you want to be resolved. This guarantees the promise has resolved in each step, before moving onto the next step. If you have multiple promises you can return Promise.all([promise1, promise2, ...]) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

MDN Web Docs
Andy Nguyen
2019-01-21 19:17:12

It might be worth testing out the modals into two scenarios. The examples you presented tightly couples the "opening of a modal" and "doing something inside of a (sub)modal". Here is a possible refactor, which should make the scenarios cleaner. Feature: Accomplish some cool task 1. Scenario: Main Modal opens up Sub Modal on button click 2. Scenario: Sub Modal does stuff based on user interaction

Andrew
2019-01-21 19:37:48

Thanks for the reference, I will take a look into the page about using promises but I have been using async/await so far and all the asynchronous operations have been handled correctly (i.e all of protractor's functions). Regarding the second point- even if you split it into two scenarios, wouldn't you still need to open the sub modal from the main modal before you can have the sub modal do stuff 'based on user interaction' ? In this case, your feature will look something like

When the user opens the submodal
And the sub modal does stuff based on user interaction

Essentially I guess my question here is where do you instantiate the Sub Modal page object ?

Andy Nguyen
2019-01-21 19:46:42

Opening the sub modal from the main modal doesn't have to be necessary. You can split up the tests like this Given a modal, when a button is clicked in the modal, then a sub modal is displayed Given a sub modal, when interacted on a certain way, then this stuff is visible It depends if your code is structured in a way where you can create a sub modal without needing its parent modal.

👍 Andrew
Andy Nguyen
2019-01-21 19:52:04

Technically they are instantiated in two places. The first scenario being this.submodal = mainModal.clickButton() //Located in your when statement The second scenario, this.submodal = **require/new subModal(..)/etc.** //Located in your given statement whatever you use to instantiate your sub modal.

👍 Andrew
Andrew
2019-01-21 20:16:16

Unfortunately I can only access the sub modal by clicking on some button in the main modal. In my test case I have already done what you mentioned above ( splitting it into two scenarios). In the first scenario I open the sub modal via the main modal and verify that all UI elements are present. In the second scenario I open the sub modal via the main modal, perform some actions in the sub modal, then verify the correct behaviour is performed.

Andrew
2019-01-21 20:16:38

I also realised I had some errors in the initial code example I sent (I have updated it now)

Andrew
2019-01-21 20:26:07

In the example above, I am access the doSomething() method in the SubModal page object via the MainModal (mainModal.subModal.doSomething()). Is there any glaring problems doing it like this?

Andrew
2019-01-21 20:26:49

(sub modal page object is instantiated in the constructor of the main modal)

Andrew
2019-01-21 20:33:50

The one limitation I am facing right now with this method is that the complexity of the angular website I am testing means there are lots of nested page objects. This makes method calls overly long e.g somePageObject.anotherPageObject._.doSomething().

Andrew
2019-01-21 20:34:59

But as I am with dealing with so many different page objects, I'm not too sure where I should be instantiating each one, which is why I am using this 'nested' structure where the creation of these objects aren't done explicitly in the spec file

Andrew
2019-01-21 20:37:48

Is this a problem with how I am creating/structuring my page objects?

Andrew
2019-01-21 20:39:08

For something like this I would have a MainPage page object, that holds references to the LeftPanel, MainPanel and RightPanel page objects. And then because the MainPanel has a button that opens a pop up modal, I have a reference to the PopUpModal page object in the MainPanel

Andrew
2019-01-21 20:39:32

So calling a method in the PopUpModal page object would look like mainPage.mainPanel.popUpModal.doSomething()

Andrew
2019-01-21 20:44:36
// main-page.page.ts
class MainPage {
    public leftPanel: LeftPanel
    public mainPanel: MainPanel
    public rightPanel: RightPanel

    constructor() {
        this.leftPanel = new LeftPanel();
        this.mainPanel = new MainPanel();
        this.rightPanel = new RightPanel();
    }

    // rest ommitted
}

// main-panel.page.ts
class MainPanel {
    public popUpModal: PopUpModal;

    constructor() {
        this.popUpModal = new PopUpModal();

    }
}
Andrew
2019-01-21 20:46:03

In reality, the page objects would have names related more closely to the domain (instead of MainPanel, LeftPanel etc), but I wanted to give a generic example to illustrate my idea

Andy Nguyen
2019-01-22 04:30:08

There doesn’t seem to be any glaring problems, looking at the example code you provided. It seems like your modals are in a tree shape, similar to how React uses a component tree like structure. When you are constructing the MainPanel PO in your tests, do you need to first instantiate MainPage PO? Are you proxyquiring modules that aren’t being looked at in test?

Andy Nguyen
2019-01-22 04:31:41

Also, looked into async/await. Async makes a function return a promise, so that is why that code snippet works. Choose what you prefer / makes the code cleaner.

Andrew
2019-01-22 12:03:57

So, in my spec file I only instantiate a single MainPage PO (this PO then instantiates all left, right and main panel PO's in its constructor). It looks something like this

// inside some-spec-file.ts
const mainPage = new MainPage();

When("the user opens the pop up modal", async () =&gt; {
    await mainPage.mainPanel.openPopUp();
}):

Then("the user does something in the pop up modal", async () =&gt; {
    // PopUpModal is created in the constructor of MainPanel which is created
    // in the constructor of MainPage
    await mainPage.mainPanel.popUpModal.doSomething();
});
Andrew
2019-01-22 12:04:56

This line of code const mainpage = new MainPage()- its not saved in the World object so does it only get created once throughout the running of the entire test suite?

Andrew
2019-01-22 12:06:24

Also, you could imagine these method calls getting longer and longer when the nested tree structure becomes more complex- which is why I am trying to find a better way to do things

Andy Nguyen
2019-01-22 19:21:11

Here is a way of you can split up your tests. As you can see in this example at the bottom, to achieve the ability of not having extremely long nested calls, you need to be able to instantiate the components/modals separately. This layout makes the code cleaner, and achieves a strong test suite. @Andrew

👍 Gem
Andrew
2019-01-22 19:49:27

Are you suggesting that the openPopUp() method in the MainPanel PO (which sends a click command to the button) returns a PopUpModal PO ?

Andy Nguyen
2019-01-22 20:25:51

It doesn't have to (just a single suggestion, out of different implementations), but MainPanel does do some delegation of some action to another component. Is this interpretation correct? You can verify that the MainPanel does the action it needs to do for unit testing, and you can verify that PopUp Modals does what it needs to do as well in other unit tests. You can then write an end to end test to see if the components work together to achieve expected behavior, solving the nested calls problem. I also have another question @Andrew. For these examples, were the tests written before the code was created (or is this an existing code base)?

edd
2019-01-23 03:44:05

@edd has joined the channel

Andrew
2019-01-23 12:39:22

Thanks @Andy Nguyen, I'll give that a shot. Also, yes this is an existing code base so I am writing the tests after- originally I was focusing too much on the UI when writing tests so I'm trying to have a perspective shift now.

Andrew
2019-01-23 12:43:35

Also, I currently have X groups of tests, and for each group I would like to create a custom World object. Do you know how to achieve this? More specifically, I would like to be able to define an interface in TypeScript for the variables that would be stored in each world object. I saw this article https://sylvain.pontoreau.com/2018/04/30/typescript-cucumber-getting-started/, which describes how to add types to the default World object (so you are able to get intellisense suggestions) but I was wondering if this is possible for custom Worlds.

Sylvain Pontoreau
Sylvain Pontoreau (https://sylvain.pontoreau.com/author/spontoreau/)
Andy Nguyen
2019-01-23 15:33:06

*Thread Reply:* @Andrew From my understanding Cucumber.js doesn't allow you to share state between different scenarios (and may be an anti-pattern? I need confirmation on this statement). You can use the before/after hooks with tagging to setup and tear down state for each scenario in a group https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md

Raymond
2019-02-07 17:00:57

*Thread Reply:* @Andrew I have raised this issue which would be a great feature that could allow the configuration of multiple world classes based on test type. Feel free to chime in what any other suggestions. Another way you could do it is by having different support folders declared in your cucumber profile but I'd like to stay away from separation by folder and instead let tags drive world configuration. https://github.com/cucumber/cucumber-js/issues/1174

Brikend
2019-01-23 12:46:58

@Brikend has joined the channel

Brikend
2019-01-23 12:47:42

hello. I'm trying to integrate cucumber.js into my existing project, and am having a bit of difficulty. I'm getting the example test I made to run when I have a folder in my root directory called features/, but I'd like to put this folder inside my tests/cucumber/ folders. Could anyone help me out with this?

Cat
2019-01-23 12:50:39

*Thread Reply:* How are you passing it into Cucumber? (cli or cuke options - just need to see how you’re passing it in)

👍 Andy Nguyen
Brikend
2019-01-23 13:35:32

*Thread Reply:* Hi cat, I used the ./node_modules/.bin/cucumber-js command

Brikend
2019-01-23 13:36:28

*Thread Reply:* all works well when the features folder is in the root directory, but I can't seem to find any way to run the tests if the folder is elsewhere

Cat
2019-01-23 13:54:27

*Thread Reply:* Right. Cucumber has to be told where to read files from (if they aren’t in default locations). How are you passing that in?

Brikend
2019-01-23 14:03:46

*Thread Reply:* Not sure where i'd be passing that in. Sorry I'm brand new to cucumber

Brikend
2019-01-23 14:07:56

*Thread Reply:* I did try cucumber.js tests/cucumber/features/example.feature as well as --require but neither worked

Andy Nguyen
2019-01-23 14:15:14

*Thread Reply:* Try node_modules/cucumber/bin/cucumber-js test/features You shouldn't need require

Andy Nguyen
2019-01-23 14:20:21

*Thread Reply:* I made a full stack Cucumber React boilerplate last night with a feature folders in a test directory (instead of root). If the previous advice doesn't work, taking a look at this repo should help you run feature folders in directories outside of test, https://github.com/NguyenAndrew/careen.

Language
<p>JavaScript</p>
Last updated
<p>17 hours ago</p>
slackbot
2019-01-23 14:20:21

*Thread Reply:* Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

Brikend
2019-01-23 14:33:12

*Thread Reply:* Thanks, Andy. I did try that and i'm getting 'no such file or directory'

Brikend
2019-01-23 14:47:43

*Thread Reply:* I restarted my terminal, and now i'm no longer getting 'no such file or directory' but it thinks my feature is empty: 0 scenarios 0 steps 0m00.000s

Andy Nguyen
2019-01-23 14:48:52

*Thread Reply:* In your folder structure, can you indicate for me where your feature files and step definition files are located?

Brikend
2019-01-23 14:51:39

*Thread Reply:* Sure. here's my folder structure right now:

project
  |-- tests
          |-- cucumber
                  |-- features
                          | --example.feature
                          | --step_definitions
                                    |-- stepdefs.js
Andy Nguyen
2019-01-23 14:55:34

*Thread Reply:* So instead of doing node_modules/cucumber/bin/cucumber-js test/features Try doing the following node_modules/cucumber/bin/cucumber-js tests/cucumber/features

Brikend
2019-01-23 14:56:16

*Thread Reply:* that worked perfectly. thank you both for your help I really appreciate it

Andy Nguyen
2019-01-23 14:56:39

*Thread Reply:* No problem! Glad to be of help

Brikend
2019-01-23 14:57:01

*Thread Reply:* btw Andy that boilerplate is awesome! i miss using react 😢

💯 Andy Nguyen
Andy Nguyen
2019-01-23 15:00:46

*Thread Reply:* Thanks for the compliments. Hope you can jump back to the React world soon.

Andrew
2019-01-23 19:44:15

Sorry, I may have misphrased my question. Say I have Scenario's A1,A,2,B1,B2,C1,C2. All I want is that A1 and A2 use CustomWorldA (this world can and still should be refreshed after each scenario -> so A1 and A1 receive fresh world instances), and B1 and B2 to use CustomWorldB and so forth.

Andrew
2019-01-23 19:45:17

I would like to define some types for the variables that will be saved in each custom world

Andy Nguyen
2019-01-23 23:00:10

I think I just read your question too fast. I would start with just using different variable names to define the type of your variables in your world for MVP (i.e. single world for all of your scenarios). I am not sure if you can specify which "typed" world to use for individual/groups of scenarios.

Cat
2019-01-24 04:11:51

You can specify world by passing it via CLI. For what’s being described, however, I’d just use before hooks and tagging 🤷‍♀️:skintone2:

Cat
2019-01-24 04:14:59

Hooks, steps, and world all share ‘this’ so for specific variables that should be shared across certain tests, it’s a bit easier to go by tagging and hooks when you need to debug.

Omar
2019-01-24 07:50:10

Hello all, I’m using protractor-cucumber-framework and would like to increase the cucumber global timeout.

It appears that increasing the protractor global timeout is not working. I believe the cucumber global timeout is the one that needs to be updated.

Anyone knows the proper way to increase the global cucumber timeout globally in this framework?

Andy Nguyen
2019-01-24 07:53:38

*Thread Reply:* You can set the timeout globally with: ```var {setDefaultTimeout} = require('cucumber');

setDefaultTimeout(60 ** 1000);``` This link show you how to set the timeout both locally and globally https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/timeouts.md

Omar
2019-01-24 08:01:12

*Thread Reply:* Thanks Andy, I’m using protractor.conf.js to run my tests. I’m not sure where this will fit in this file. I get an error when I set the timeout in it.

var {setDefaultTimeout} = require('cucumber');

setDefaultTimeout(60 ** 1000);

error:

setDefaultTimeout(60 ** 1000);
                          ^^
SyntaxError: Unexpected number
Cat
2019-01-24 08:24:25

*Thread Reply:* iirc (been a while since i used protractor), you can just pass it into cucumberOptions in the conf

Omar
2019-01-24 08:40:43

*Thread Reply:* This is what I currently have:

    cucumberOpts: {

        require: ["features/step_definitions/**", "support/hooks.js"],
        format: "json:./reports/cucumber_report.json",
        tags: ['~@todo', '@regression'],

    },

what it the proper way to add setDefaultTimeout(60 ** 1000) to it?

Omar
2019-01-24 09:13:46

*Thread Reply:* I tried multiple things but none worked.

Cat
2019-01-24 09:23:59

*Thread Reply:* hm. try plugging in defaultTimeout: (yourTimeout) or just timeout: (yourTimeout) in that config.

Cat
2019-01-24 09:26:09

*Thread Reply:* I handle the setDefaultTimeout bit in my world setup code so how I pass it in is a bit different than what you’re doing. However, iirc, it should be passed in through options.timeout if it’s coming through as cucumberOpts

Omar
2019-01-24 09:27:44

*Thread Reply:* i’ll try it, thanks!

Cat
2019-01-24 09:28:01

*Thread Reply:* 👍

Omar
2019-01-25 07:12:51

*Thread Reply:* I tried plugging in defaultTimeout and also timeout but none worked.

Omar
2019-01-25 07:13:06

*Thread Reply:* 😫

Cat
2019-01-25 08:15:24

*Thread Reply:* hm. I’d suggest having a look at the protractor-cucumber-framework code to see if it exposes cucumber timeouts and if perhaps it has a different naming convention?

Omar
2019-01-28 06:25:21

*Thread Reply:* I created a new file env.js and added

module.exports = function() {
    this.setDefaultTimeout(10 ** 1000);
};

then added this to protractor.conf.js under cucumberOpts

require: ["features/step_definitions/**", "support/hooks.js", "support/env.js"],
Omar
2019-01-28 06:26:43

*Thread Reply:* There has to be a simpler solution but this works for now. Thanks @Cat @Andy Nguyen!

👍 Cat
Raymond
2019-02-07 17:05:59

*Thread Reply:* @Omar In your protractor config file, there is an onPrepare method available to you. You should be able to set the timeout in there.

Omar
2019-02-08 05:49:32

*Thread Reply:* I’ll try it out. Thanks @Raymond!

👍 Raymond
Raymond
2019-02-08 10:15:38

*Thread Reply:* Let me know if it doesn't work and I can dig a little more but i suspect it will

slackbot
2019-02-08 10:15:38

*Thread Reply:* Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

slackbot
2019-01-24 07:50:11

Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

olleolleolle
2019-01-24 11:12:46

@olleolleolle has left the channel

Stef
2019-01-30 02:02:43

@Stef has joined the channel

Madhulika
2019-02-03 17:22:16

@Madhulika has joined the channel

Madhulika
2019-02-03 18:14:05

Hi everyone, I am new to cucumber and javascript and have a quick question. I have a test where I do some actions and in the end, would like to verify if certain text is visible on the page. I would like my function to be some like “isTextVisible”. In selenium java, I would do something like below

Madhulika
2019-02-03 18:14:53

if(driver.getPageSource().contains("Text to check")){ System.out.println("Text is present"); }else{ System.out.println("Text is absent");

Madhulika
2019-02-03 18:16:40

I am trying to do something similar but JS does not identify getPageSource as a function and throws the error TypeError: driver.getPageSource(...).contains is not a function

Madhulika
2019-02-03 18:17:52

i would appreciate any help on how to make this work. PS: I read about node js Assertions and I thought those would not serve my purpose in this case unless I am wrong.

Andy Nguyen
2019-02-03 20:05:34

*Thread Reply:* This seems more like a selenium webdriver question than a cucumber question. However, I did look into this question for you. https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/ie_exports_Driver.html#getPageSource returns a promise to a string. If you don't know promises, callbacks, or how asynchronous code works in JavaScript definitely do some research before continuing past this code. In any case do driver.getPageSource().then((source) =&gt; { if source.contains("Text to check") {...} else {...} });

💯 Cat
Madhulika
2019-02-04 01:45:34

*Thread Reply:* Thank you so much @Andy Nguyen!. That worked with a minor change. .contains does not work in chrome. So, I had to use source.indexof https://stackoverflow.com/questions/19589465/why-javascript-contains-property-is-not-working-in-chrome-browser. Anyways, thanks again 🙂

Stack Overflow
👍 Andy Nguyen
Shabbir Ahmed
2019-02-03 20:42:59

@Shabbir Ahmed has joined the channel

Fabio
2019-02-04 15:18:14

@Fabio has joined the channel

Raymond
2019-02-07 12:57:51

@Raymond has joined the channel

Lucas Barbosa Contreiro
2019-02-11 06:31:31

@Lucas Barbosa Contreiro has joined the channel

Lucas Barbosa Contreiro
2019-02-11 06:31:51

Hi everybody, can you help me with this issue? I'm trying to change the final report of cucumber, because I don't want to show messages like 'timeout'. I want to change to 'element not found' or something like that. How can I do that?

Raymond
2019-02-11 09:10:23

@Lucas Barbosa Contreiro Catch and throw the error

Lucas Barbosa Contreiro
2019-02-11 09:56:48

I used try catch, but on catch I put 'console.log('error message', error). I would like to change the message of timeouts that came together.

Raymond
2019-02-11 09:58:36

Throw a new error on the catch

Cat
2019-02-11 09:58:58

then you’d just throw a new error with whatever specific text you’re wanting - although if you’re timing out, you may want to evaluate where the timeout is coming from - your driver or cucumber (or underlying helpers)

Raymond
2019-02-11 10:00:30

Something like this ^

Lucas Barbosa Contreiro
2019-02-11 10:02:50

when I use this code, I receive this: × failed Error: function timed out, ensure the promise resolves within 20000 milliseconds at Timeout.time.default.setTimeout [as _onTimeout] (\nodemodules\cucumber\lib\usercoderunner.js:81:20) at listOnTimeout (timers.js:324:15) at processTimers (timers.js:268:5)

Lucas Barbosa Contreiro
2019-02-11 10:04:02

I'm trying to change the message of timeout to another, like you put there "Unable to find element"

Raymond
2019-02-11 10:25:20

That is the default cucumber timeout

Raymond
2019-02-11 10:25:32

Can you share an example of your code

Raymond
2019-02-11 10:26:37

This points to a different problem, the problem being that your default timeout for cucumber is less than your selenium timeout

🎯 Cat
Lucas Barbosa Contreiro
2019-02-11 10:28:19

const selector = '#login-button';

try {
  await this.document.waitForSelector(selector);
} catch (error) {
    throw new Error('Unable to find element');
}
Lucas Barbosa Contreiro
2019-02-11 10:29:25

I'm trying to do that. But i would like to receive the message of 'Unable to find element', not the timeout default error

Cat
2019-02-11 10:30:25

Right - the issue is that your underlying function is taking longer than what you’ve set cucumber to timeout at

👍 Raymond
Raymond
2019-02-11 10:30:26

await this.document.waitForSelector(selector); Cucumber is timing out here ^ not selenium You have a couple of choices

  1. Increase your cucumber timeout to a higher value
  2. Increase your selenium timeout to a lower value
  3. Pass in a custom timeout to the above waitForSelector method
  4. Add a custom cucumber timeout to that method
💯 Cat
Cat
2019-02-11 10:32:24

Since many cucumber step definitions may require the execution of multiple driver async functions in a single stepDef, i strongly recommend setting the default cuke timeout to be a bit higher than your default driver setting

Raymond
2019-02-11 10:33:48

*Thread Reply:* I agree with @Cat a custom timeout on each call is a bad choice. My opinion is to increase the cucumber timeout.

☝️ Cat
Lucas Barbosa Contreiro
2019-02-11 10:36:37

*Thread Reply:* The problem isn't find the element. I want to handle errors when it happens. I'm trying to nominate my errors to do a better log for the UI Tests.

Raymond
2019-02-11 10:40:02

*Thread Reply:* Agreed the problem isn't finding the element because you actually don't know if it's being found or not because cucumber keeps timing out first.

Lucas Barbosa Contreiro
2019-02-11 10:43:41

*Thread Reply:* Yes. My tests are working fine. But I need to do a error handling because I want to make the code more maintable for everyone.

Cat
2019-02-11 10:44:20

*Thread Reply:* ^^ Raymond is correct. The issue is that you’re trying to solve it in the wrong place - you need to give cucumber a longer timespan than the underlying driver functions in your step definition. If you run a stepdef with cucumber and set timeout to 2k, but your driver is set to 3k, cucumber gets the error. Cucumber has already failed your test before driver can finish attempting to resolve - this is exacerbated further if your stepDef is a helper function that waits for multiple driver functions to resolve.

Cat
2019-02-11 10:44:41

*Thread Reply:* Yes. And you cannot capture an error in your driver if you aren’t waiting for it to fail

Cat
2019-02-11 10:45:09

*Thread Reply:* You fail in cucumber right now before giving driver time to fail

Cat
2019-02-11 10:45:32

*Thread Reply:* You will not capture an error at driver level if you consistently timeout in cucumber (because that wraps your driver step)

Lucas Barbosa Contreiro
2019-02-11 10:49:24

*Thread Reply:* const selector = '#login-botao1';

const promise = new Promise((resolve, reject) =&gt; {
  setTimeout(async () =&gt; {
    await this.document.waitForSelector(selector);
    resolve();
  }, 20000);

  reject();
});

try {
  await promise;
} catch (error) {
    throw new Error('Unable to find element');
}
Lucas Barbosa Contreiro
2019-02-11 10:49:48

*Thread Reply:* I change the code for that and receive this message: Error: Unable to find element

Lucas Barbosa Contreiro
2019-02-11 10:50:02

*Thread Reply:* But the problem is that always got reject...

Raymond
2019-02-11 11:00:39

*Thread Reply:* Looks to me like the same problem with the only difference being you now have control of the problem

Raymond
2019-02-11 11:01:31

*Thread Reply:* Have you confirmed waitForSelector works. Also what error is being received into the catch? I presume the timeout error again right?

Lucas Barbosa Contreiro
2019-02-11 11:04:43

*Thread Reply:* × failed Error: Unable to find element at Login.<anonymous> (\tests\acceptance\pages\login.ts:33:15) at step (\nodemodules\tslib\tslib.js:133:27) at Object.throw (\nodemodules\tslib\tslib.js:114:57) at rejected (\node_modules\tslib\tslib.js:105:69)

Lucas Barbosa Contreiro
2019-02-11 11:05:39

*Thread Reply:* I would like to have this error on my log and I got this

Lucas Barbosa Contreiro
2019-02-11 11:05:57

*Thread Reply:* But now, is always getting error

Raymond
2019-02-11 11:07:10

*Thread Reply:* Can you console log the error the catch is getting before you throw your custom error

Raymond
2019-02-11 11:07:33

*Thread Reply:* Have you confirmed your waitForSelector method actually works?

Lucas Barbosa Contreiro
2019-02-11 11:10:21

*Thread Reply:* Yes, it's working fine

Raymond
2019-02-11 11:30:46

*Thread Reply:* So it has found elements before?

Lucas Barbosa Contreiro
2019-02-11 11:57:03

*Thread Reply:* Yes

Raymond
2019-02-11 12:06:10

*Thread Reply:* Okay can you console print the error entering in the catch

Lucas Barbosa Contreiro
2019-02-11 12:20:03

*Thread Reply:* console.log of error got undefined

Raymond
2019-02-11 13:06:35

*Thread Reply:* That doesn't sound right You did console.log(error) at the start of the catch right?

Lucas Barbosa Contreiro
2019-02-13 04:45:49

*Thread Reply:* I resolved the problem using promise (resolve, reject). I remove some calls in the function and worked fine. Thanks for the help! 😁

slackbot
2019-02-13 04:45:49

*Thread Reply:* Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Lucas Barbosa Contreiro
2019-02-11 10:32:43

how can I add a custom cucumber timeout? Surround the waitForSelector with a timeout and throw the exception there?

Cat
2019-02-11 10:33:50

pass it into your stepdef

Cat
2019-02-11 10:34:11

But as mentioned - custom timeouts don’t scale (usually)

☝️ Raymond
Raymond
2019-02-12 09:55:08

@channel I have setup a new channel <#CG5736HU5|cucumber-js-git> which integrates slack with the cucumber-js github repo

Raymond
2019-02-12 09:55:43

For more info on what that will look like feel free to 1. Join 2. Take a look at https://slack.github.com/

mpkorstanje
2019-02-12 09:56:12

Don't we have a bots-js channel?

💯 Gem
mpkorstanje
2019-02-12 09:57:50

Yeah we do <#C7DNCJVA7|bots-js>

Raymond
2019-02-12 09:58:01

Oh yea there is

Raymond
2019-02-12 09:58:09

Thanks for pointing that out

Gem
2019-02-13 08:47:58

<#C612KCP1P|committers-js> might be a better channel to announce this in, too. 😛

Lucas Barbosa Contreiro
2019-02-14 07:55:56

Hey people, what's up?

Lucas Barbosa Contreiro
2019-02-14 07:56:18

What's the command do you use after a click? waitFor? waitForNavigation?

Cat
2019-02-14 08:08:22

*Thread Reply:* That’s going to vary quite a bit based on which driver you’re using. It’s also not really a cuke question 😉

Raymond
2019-02-14 09:31:08

*Thread Reply:* Like @Cat says we are going to need some more context. Also that is a selenium question and can be asked in #selenium

err0r500
2019-02-15 03:25:28

@err0r500 has joined the channel

err0r500
2019-02-15 03:48:48

Hi I'm new to cucumber(JS), and I'm looking for examples of dependency injection... my main goal would be to get rid of this.something (especially when this refers to an object located in another file...) in order to access to shared instances in handling functions... do you have some ideas ?

err0r500
2019-02-15 04:09:35

OK, since I'm in typescript I discovered cucumber-js-tsflow, perfect 🙂

err0r500
2019-02-15 04:18:36

example :

import {TableDefinition} from "cucumber"
import { binding, given, before } from "cucumber-tsflow"

import {Customer} from "../../src/domain/customer"
import {InMemoryCustomerRepo} from "../../src/adapters/inMemoryCustomerRepo"
import {CustomerRepo} from "../../src/domain/interfaces"

class CustomerConfig {
    public customerRepo: CustomerRepo;

    public constructor() {
        this.customerRepo = new InMemoryCustomerRepo()
    }
}

@binding([CustomerConfig])
class CustomerSteps {
    private customerRepo: CustomerRepo;

    @given(/^des clients existent:$/)
    private clients(dataTable: TableDefinition): string | void | Error {
        dataTable.rows().map((r) =&gt; {
            this.customerRepo.Create(new Customer(r[0], r[1], r[2]))
        })
        return "pending"
    }

    public constructor(config: CustomerConfig){
        this.customerRepo = config.customerRepo
    }
}

export = CustomerSteps
Maxim
2019-02-16 05:08:49

@Maxim has joined the channel

Maxim
2019-02-16 05:13:32

My main questions are "What should I do to make the browserstack-cucumber-js repo work with the newest version of cucumber, seleniumwe driver and cucumber-assert?"

And

"Is it worth trying or can you point me in the direction of an up-to-date documentation explaining how to use cucumber-js with browserstack?"

Cat
2019-02-16 17:20:50

*Thread Reply:* If I’m not misremembering, you can just pass in your browserstack config via your webdriver config (webdriverio has some good examples). It’s going to vary some based on what you’re using, but isn’t so much a cucumber question.

Maxim
2019-02-18 01:37:17

*Thread Reply:* The Browsertstack repo uses the selenium webdriver and I guess the hooks.js file to configure it to use browserstack. But it only works with the old versions of cucumber and selenium the repo uses. So you think I can easily build it myself with new versions? Do you maybe have a good video or documentation on that

Cat
2019-02-18 06:07:14

*Thread Reply:* webdriverio is a wrapper for selenium webdriver + appium. whether you’re using selenium webdriver or webdriverio, you should be able to pass the Browserstack parameters through the config. BrowserStack has docs here: https://www.browserstack.com/automate/node

browserstack.com
Gem
2019-02-16 12:24:03

@Maxim I'm not as familiar with the js version, but someone who is may be able to get back to you, just be patient. 🙂

Madhulika
2019-02-19 17:23:15

Hi, I am trying to enter a text in to a field with no input tag. It has only label tag. Using selenium cucumber js. Below is my step definition

Madhulika
2019-02-19 17:23:36

this.Then(/^I enter "(.**)" into the First name field$/, text =&gt; { var firstName = by.css("label[for='firstname']"); shared.helpers.click(firstName); return shared.helpers.enterTextInField(text, firstName); })

Madhulika
2019-02-19 17:23:59

I added the extra line with click because I was getting following error

Madhulika
2019-02-19 17:25:42

however, that did not fix it. I tried several options and kind of fed up. Any help would be appreciated on how I can enter the text successfully in to the fields 🙏

Cat
2019-02-19 21:42:18

*Thread Reply:* It’s an issue with how you’re interacting with the DOM, hence the selector error. It’s pretty much entirely unrelated to cucumber. 🤷‍♀️:skintone2: The selector you’re using cant interact with the dom in the way you’re attempting to. The most likely cause is that you’re attempting to set the input value in the wrong place. If you’re still struggling with it, you may want to check out #selenium or seleniumhq.slack

Madhulika
2019-02-19 17:26:32

below is the html

Raymond
2019-02-20 13:34:09

*Thread Reply:* Can you open up the divs as it looks like First name is a header and not an input field

Gem
2019-02-19 19:56:24

Hey @Madhulika have you tried looking up selector errors with webdriver as that's what's producing the error

Gem
2019-02-19 20:26:44

cannot focus element sounds like your selector isn't able to find the element.

Gem
2019-02-19 20:29:28

I think the selector you're trying should work but might not be perhaps because it looks like there's no actual input bound to it?

Madhulika
2019-02-20 09:22:09

*Thread Reply:* Hi @Gem: yeah, the problem is because there is no input tag. I will see if there are some workarounds. thank you.

👍 Gem
Akaan
2019-02-20 00:59:56

@Akaan has joined the channel

Akaan
2019-02-20 01:01:05

Hi, I'm trying to set a project up with cucumber-js using typescript.

Akaan
2019-02-20 01:02:16

Everything is fine until I try to define and use a profile instead of having the full command line in my package.json

Akaan
2019-02-20 01:03:12

My package.json goes like this :

Akaan
2019-02-20 01:05:09

But if I add a cucumber.js file in the root directory and execute cucumber-js I get the following error :

Akaan
2019-02-20 01:06:05

TypeError: cucumber_1.After is not a function

Akaan
2019-02-20 02:55:49

I found the problem but I've yet to find a solution to it

Akaan
2019-02-20 02:57:04

When I add the cucumber.js file, it clashes with the cucumber library when I do import { After } from 'cucumber;

Akaan
2019-02-20 02:58:26

Got it. Had to make minor changes to tsconfig.json

👍 Gem
Gem
2019-02-20 07:41:24

@Akaan Could you share what config changes you had to make with us here so that in the future it could be used to help others?

Akaan
2019-02-20 08:03:18

Sure ! My tsconfig.jsonhad "baseUrl": "." so that import { After } from 'cucumber'would try to import from the cucumber.jsfile at the root of the project instead of importing it from the node module.

Madhulika
2019-02-20 19:38:41

Hi everyone, what is the best way to do UI and API testing using Cucumber.js. I have a usecase where a scenario starts with some UI steps and then I need to hit the Gmail API to fetch a link from an email (that was sent from the UI test). After I get the link I need to go to it and do some more UI actions. Should I separate the UI and API tests in to separate directories?

Gem
2019-02-20 20:32:34

You should separate things as it makes sense to you and your team. 🙂

mlvandijk
2019-02-20 22:19:04

@Madhulika are the UI and API steps part of the same test, or are they separate tests for different features? I'd group tests/scenarios according to functionality and features and might group step definitions related to which part of the domain they deal with. A division with type of step definitions (UI, API, mock) might also make sense.

Madhulika
2019-02-20 23:01:40

thanks @mlvandijk. The UI and API steps are part of the same test i.e same scenario and I have multiple scenarios like that.

mlvandijk
2019-02-20 23:38:26

In that case I might personally group them into UI step defs and API step defs. But grouping by domain would also work.

mlvandijk
2019-02-20 23:38:44

Or one of those as a subdivision of the other.

mlvandijk
2019-02-20 23:39:05

Whichever makes the most sense to you and your team :)

☝️ Gem
Acooper
2019-02-26 05:52:42

@Acooper has joined the channel

Acooper
2019-02-26 05:53:31

Hi everyone, can cucumberjs be used without a broswer to test at a lower level like jasmine is being used?

Raymond
2019-02-26 09:08:26

*Thread Reply:* Yes I use it as integration and api level as well

Acooper
2019-02-26 10:37:35

*Thread Reply:* ok how

Acooper
2019-02-26 10:37:40

*Thread Reply:* any docs?

Raymond
2019-02-26 11:35:40

*Thread Reply:* I can try put together an example this weekend if I get time but the cucumberjs docs should be all you need https://github.com/cucumber/cucumber-js/tree/master/docs

Acooper
2019-03-12 10:29:04

*Thread Reply:* So at a lower level chai is the runner? https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md

Acooper
2019-03-12 10:29:26

*Thread Reply:* Also when your using it a a lower level what are you using mocking?

Raymond
2019-03-12 15:25:26

*Thread Reply:* @Acooper No. Cucumber is still the runner

Raymond
2019-03-12 15:25:45

*Thread Reply:* A mix of mocks and real service depending on your needs

Acooper
2019-03-15 07:47:49

*Thread Reply:* are you using angular 7?

Raymond
2019-03-15 10:49:04

*Thread Reply:* No but it doesn't matter. Cucumber has no dependency on what it is testing. Cucumber is simply a framework to trigger some code to run

Hazan
2019-02-26 06:02:46

@Hazan has joined the channel

Hazan
2019-02-26 06:03:42

Hello< I am scratching my head to find a way to connect cucumber-selenium-js to a selenium grid hub. I am sure there must be a config variable to put the hub address but I am not finding it. Can someone help? Please🙏

Cat
2019-02-26 09:56:34

*Thread Reply:* I haven’t worked with that particular implementation, but I’d assume that you can probably just use selenium standalone, which can get your grid sorted out. https://www.npmjs.com/package/selenium-standalone

npm
Leo
2019-02-26 10:13:24

@Leo has joined the channel

Leo
2019-02-26 10:13:42

is there anyway to re-run failed scenarios in cucumberJS without having to define a custom reporter using webdriverIO?

LalithaR
2019-02-26 10:24:39

*Thread Reply:* https://cucumberbdd.slack.com/archives/C60TKS3SL/p1551200783073000?thread_ts=1551164882.031900&cid=C60TKS3SL

Raymond (https://cucumberbdd.slack.com/team/UG2MNPE3G)
Leo
2019-02-26 10:50:25

*Thread Reply:* Ah I see @Raymond, if you don't mind would you happen to have an example I can maybe look at?

Raymond
2019-02-26 11:34:29

*Thread Reply:* @Leo

  1. Add the formatter for reurn to the command line when running your tests(or add it to the profile) --format rerun:@rerun.txt
  2. After a failed run, remove any arguments used for selecting feature files and add the rerun file in order to rerun just failed scenarios. The rerun file must start with an @ sign in order for cucumber to parse it as a rerun file instead of a feature file.
LalithaR
2019-02-26 10:23:29

@LalithaR has joined the channel

Raymond
2019-02-26 11:45:18

Has anybody got any tips on running pre-commit hooks with cucumber? I'm thinking of implementing husky that will have a pre-commit hook to run my cucumber tests. The only additional complexity is that I don't want a failure if tests are not 100%. I'd like to have an acceptable pass rate of say 95%( 5% known bugs etc). My initial thoughts is husky could kick off a bash script which would run the tests gather the results and then do a compare on the acceptable pass rate value. The idea is that the pass rate should never fall when a dev is checking in code.

The other option is I could have only blockers in the pre-commit hook, which is an option but I'd also like to explore the option of a full regression run with an acceptable pass rate.

Leo
2019-02-26 13:25:01

does anyone also have this problem where it takes a really long time to generate an allure report ?

Raymond
2019-02-26 17:35:34

*Thread Reply:* @Leo You need to provide more info

Alexandros Katechis
2019-02-27 18:04:29

@Alexandros Katechis has joined the channel

Alexandros Katechis
2019-02-27 18:07:39

Hey all, just getting started with cucumber JS and loving it so far. I'm wondering how I can view screenshots that I've attached to my scenario results?

Alexandros Katechis
2019-02-27 18:07:41
After('@browser', async function (scenario) {
  if (scenario.result.status === Status.FAILED) {
    const b64 = await this.driver.takeScreenshot()
    await this.attach(b64, 'image/png')
  }
  await this.driver.quit()
})
Raymond
2019-02-28 09:26:49

*Thread Reply:* @Alexandros Katechis In the directory mentioned in the this.attach method or by viewing the report

Rahul Gupta
2019-03-07 09:15:48

@Rahul Gupta has joined the channel

Rahul Gupta
2019-03-07 09:16:55

Hi Folks please some help me ,How to pass the data from JSON file to the feature file ????

Cat
2019-03-07 09:24:11

*Thread Reply:* You’d need to leverage hooks and/or stepDefinitions. We’d need more information to be able to help beyond that.

Andy Nguyen
2019-03-07 09:20:42

@Rahul Gupta Can you give an example scenario you are trying to solve for? From initially looking at your question, I can't think of a reason why you would need to do so at the feature level compared to the step_definitions level.

Rahul Gupta
2019-03-07 09:25:56

instated of creating dataset in table i want use json

Rahul Gupta
2019-03-07 09:38:54

how we can call this table data in hook

Rahul Gupta
2019-03-07 09:39:18

i am trying to do with tag

Rahul Gupta
2019-03-07 09:39:41

but how can i access this table data set in before hook ?

Cat
2019-03-07 09:42:22

I’m not sure exactly what you’re trying to accomplish. Why not just import a JSON file in the hooks/stepdefs/whatever you like?

☝️ Gem
Gem
2019-03-07 09:45:52

Unless the data in there is specifically useful for folks to read, may as well push it into json. 🙂

🎯 Cat, mlvandijk
Rahul Gupta
2019-03-07 09:47:06

ok thank you

👍 Gem
Rahul Gupta
2019-03-07 09:47:46

one more question i have

Rahul Gupta
2019-03-07 09:49:39

if i have defined some data in before hook assume like var data="cucumberbdd"

Rahul Gupta
2019-03-07 09:50:56

how we can access this assigned data in step function ?

Cat
2019-03-07 09:51:47

you’re just assigning a variable there. To make it available in a step definition, you need to pass it in as this.data = 'cucumberbdd';

Gem
2019-03-07 09:56:02

Using this adds data to the world which makes things sharable across step definitions.

Cat
2019-03-07 09:57:23

^^ and hooks 😉

👍 Gem, mlvandijk
Gem
2019-03-07 10:00:40

I'm not as familiar with those, so I can't speak to them. 😛 I've got pretty limited cucumber-js experience. hah. godog doesn't really facilitate this so you've gotta do your own.

Cat
2019-03-07 10:01:22

we use them to swap out drivers so that this.driver can be whatever we need for a given set of tests

👍 Gem
Gem
2019-03-07 10:02:38

What do you switch between?

Cat
2019-03-07 10:03:06

not considering the specific browser drivers, wdio, appium, puppeteer, and I’m working on a POC to add Cypress for funsies.

Gem
2019-03-07 10:07:36

Ah makes sense!

Rahul Gupta
2019-03-07 10:18:19

again thank you , its worked for me

:dancing_pickle: Gem, mlvandijk
:nyanparrot: Gem, mlvandijk
Jennifer
2019-03-11 04:32:05

@Jennifer has joined the channel

Jennifer
2019-03-11 04:34:44

hey all ...... how can i enter value of text filed through cucumber ??

Cat
2019-03-11 06:12:28

Cucumber doesn’t enter text values. How you interact with your application depends entirely upon the driver(s) you’re using.

💯 Gem, Raymond, mlvandijk
☝️ Gem
Abhishek
2019-03-11 07:44:30

@Abhishek has joined the channel

mlvandijk
2019-03-12 02:55:20

You could for example use Selenium to interact with your front end.

Leo
2019-03-12 08:35:23

what are some pros / cons of using cucumberJS vs MochaJS?

Cat
2019-03-12 08:41:33

*Thread Reply:* in my experience with cucumber, it’s easier to iron out expected behavior with the entire team - designers (UI/UX)/product, quality, ops, automation, frontend, and backend engineers. Also scales much more easily for growing companies. Mocha is fine for unit tests, but isn’t precisely a BDD framework (in spite of the fact that it lists itself as such). I find it’s perfectly useful for unit, but outside of that, I think it tends not to lend itself to scalable infrastructure like cucumber can.

tooky
2019-03-12 09:14:05

*Thread Reply:* Mocha is very much like RSpec and Cucumber grew out of the RSpec project and it was always meant to be complimentary.

Leo
2019-03-12 10:33:14

*Thread Reply:* I see, so cucumber is better for end to end integration tests?

Cat
2019-03-12 11:35:51

*Thread Reply:* Yes. Particularly if you need to be able to show them externally

Cat
2019-03-12 11:36:12

*Thread Reply:* I’d much rather walk through cucumber with my PO than mocha 🙂

tooky
2019-03-12 11:45:31

*Thread Reply:* I’d say that Cucumber is better for customers tests (business facing) and mocha is better for programmer tests (technical facing).

tooky
2019-03-12 11:46:07

*Thread Reply:* https://www.youtube.com/watch?v=XgVwU-HmC_A

YouTube
Cucumber (https://www.youtube.com/channel/UC0eV4MhnmCd-48XdDhzf6Hg)
Cat
2019-03-12 11:47:33

*Thread Reply:* I think it varies. There are companies I’ve worked for where Cucumber for devs would have been a huge help. There are other companies where it would have been overkill. Depends so much on the subject matter + complexity of stack + how many distinct teams are working on multiple projects that interact, etc.

Cat
2019-03-12 11:49:13

*Thread Reply:* My last job was entirely backend.. Not the usual use-case for Cucumber. However, the backend was a knowledge expert engine. Being able to essentially build a DSL for rule conditions -> expected outcomes was surprisingly helpful.

mlvandijk
2019-03-12 14:40:03

*Thread Reply:* My current team has pretty much only back end services and we use Cucumber. The services contain business logic (i.e. behaviour)

🎯 Cat
tooky
2019-03-12 14:57:50

*Thread Reply:* When I say Customer Test and Programmer Test its not about the level of the stack we’re talking about. It’s more about who “owns” the test, who’s responsible for devising the parameters of the test and who really cares about the outcome.

Customer Test could just as easily be Business Test – for me it’s really about whether it describes the business process. It’s for describing what the software does in a way the business can understand.

A programmer test is to help the programmer write the software. It might give confidence of the correctness of the code, it might serve as an example of how to use a function or class, or if your lucky it can give you fast feedback on your design.

I’d expect most projects to have both customer and programmer tests 🙂

Cucumber is excellent for customer tests.

Lots of great stuff here on the c2 wiki: http://wiki.c2.com/?CustomerTest http://wiki.c2.com/?ProgrammerTest

mlvandijk
2019-03-12 23:02:14

*Thread Reply:* Yes, I understand the difference between programmer and customer tests, and that they're not tied to the level of the stack. E.g. in my previous team we had unit tests on front end logic. I'm just saying that Cucumber can be used at different levels of the stack. I've used it on front end and back end.

➕ Cat
mlvandijk
2019-03-12 23:03:44

*Thread Reply:* A misconception I notice is that Cucumber is for front end (only)

☝️ tooky
💯 Cat
⭐ Andy Nguyen
Gem
2019-03-12 09:34:36

@Leo While they both run tests, they ultimately serve different purposes

💯 Cat
Cat
2019-03-12 09:48:57

*Thread Reply:* you worded that much more succinctly than I could XD

😁 Leo
😅 Gem
Gem
2019-03-12 20:05:48

*Thread Reply:* haha!

Andrew
2019-03-12 18:45:31

Hi, I am using cucumber with protractor. In my config file I have defined a couple of test suites (i.e testSuiteA(containing X number of feature files), testSuiteB(containing Y number of feature files) etc). Is there any way to run each SUITE in parallel, i.e browser 1 runs testSuiteA and browser 2 runs testSuiteB and so forth. I would also want each feature file within each suite to run sequentially in the same browser.

Andrew
2019-03-12 18:48:23

Currently I can get multiple browser instances running, but they are each executing different feature files of the same test suite. I want to be able to specify the exact test suite to run for each browser.

Gem
2019-03-12 20:09:03

@Andrew You'd need to use something that parses your feature files and then manages to run them separately. Cucumber doesn't do this on its own, however. He's not in this channel, but try reaching out to @enkessler as he's got some tools for parsing gherkin

Leo
2019-03-14 07:26:47

HI , does anyone know a good plugin/package I can use to re-run failed scenarios x number of times for cucumberJS?

Cat
2019-03-14 07:27:52

*Thread Reply:* iirc, you can set retry as a configuration

Leo
2019-03-14 07:33:18

*Thread Reply:* how can i do what using the webdriverIO framework with wdio test runner?

Leo
2019-03-14 07:33:37

*Thread Reply:* I think you have answered my question before but I cannot see the history from the free version of slack haha

Cat
2019-03-14 07:46:49

*Thread Reply:* if you’re using wdio runner, check out their config docs for the version you’re using (If you’re <5, you’ll need to check the boneyard).

Cat
2019-03-14 07:46:59

*Thread Reply:* there should be a retry arg to pass, iirc

Cat
2019-03-14 07:47:27

*Thread Reply:* in my company’s initial automation project, we had a config for that, but it’s so deprecated that it may no longer be the same 😉

Cat
2019-03-14 07:48:33

*Thread Reply:* I believe there’s also a cucumber option to retry

Leo
2019-03-14 07:48:34

*Thread Reply:* but ther is no otpion with wdio to re-run entire scenarios, there is only the option to re-run individual steps..

Leo
2019-03-14 07:48:55

*Thread Reply:* I am using version <4 , v5 is not supported with wdio-cucumber yet haha

Leo
2019-03-14 07:49:57

*Thread Reply:* this is to rerun a step, not the entire scenario haha

Cat
2019-03-14 10:21:04

*Thread Reply:* hm, afaik, retry for the entire scenario is not readily available as a config option for cucumber. Ideally, you’d want to eliminate the flakes in the test, but obviously teams don’t always have the ability to do so if there are outside dependencies causing flakes 😉 I’m wondering if, in lieu of retry scenario support, one could capture the failing scenarios and kick off another cuke run using only those failed scenarios.

Cat
2019-03-14 10:21:22

*Thread Reply:* Let me rephrase: One could do this. I’m just not sure what implementation surprises would be in store 😛

Leo
2019-03-14 16:21:09

*Thread Reply:* I was able to have the test framework kick off a re-run of all of the failed feature files by adding a custom reporter in webdriverIO to track all of the failed features (feature file that contain failed scenarios), however I was not able to find a solution to have the automation re-run the failed scenarios only

Andreas Markussen
2019-03-18 08:02:43

@Andreas Markussen has joined the channel

Leo
2019-03-18 11:06:08

does anyone here use webstorm? with cucumberJS webdriverIO?

Cat
2019-03-18 11:06:51

*Thread Reply:* I do.

Cat
2019-03-18 11:07:27

*Thread Reply:* Do you mean wdio-cucumber-framework, or running cucumber with webdriverio under the hood?

Leo
2019-03-18 11:07:28

*Thread Reply:* can you help me with the set up proces? i am running into alot of isseus setting up

Leo
2019-03-18 11:07:37

*Thread Reply:* I mean "wdio-cucumber-framework"

Cat
2019-03-18 11:08:21

*Thread Reply:* can you be a little more specific re: setup problems?

Leo
2019-03-18 11:08:50

*Thread Reply:* yes, so i am able to find my step definitiions in the project by ctrl- clicking them

Leo
2019-03-18 11:09:08

*Thread Reply:* however when i try to run the project i get the error that my steps cannot be found, can you show you run configurations? This is the error i am getting telling me that my steps are undefined

Cat
2019-03-18 11:09:55

*Thread Reply:* How are you passing your step definitions into the config?

Leo
2019-03-18 11:09:58

*Thread Reply:*

Cat
2019-03-18 11:10:56

*Thread Reply:* https://github.com/webdriverio/wdio-cucumber-framework#cucumberopts-options Read these and make sure you’re passing the step defs into cucumber properly

Stars
<p>71</p>
Language
<p>JavaScript</p>
Madhulika
2019-03-18 11:38:11

Hi everyone, have anyone used https://www.npmjs.com/package/scroll-js for the scrollnToView method and got it working? I need to scroll a long page to certain sections and assert text in one of my tests. I use selenium-cucumber.js

npm
Madhulika
2019-03-18 11:38:24

below is the helper I came up with ..

Madhulika
2019-03-18 11:38:44

scrollIntoElement: function(text){ const element = shared.helpers.getElementWithText(text); scrollIntoView(element, {duration: 1000}).then(function () { console.log('Finished scrolling to required text'); }); }

Madhulika
2019-03-18 11:39:12

as I expected, I got the following error

Madhulika
2019-03-18 11:39:19

```import { scrollIntoView } from 'scroll-js'; ^^^^^^

SyntaxError: Unexpected token import at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module.compile (module.js:599:28) at Object.Module.extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18)```

Cat
2019-03-18 11:43:09

*Thread Reply:* Where are you requiring babel?

Madhulika
2019-03-18 12:37:28

*Thread Reply:* @Cat : I don't know what that is. Can you give some context?

Cat
2019-03-18 13:09:13

*Thread Reply:* https://babeljs.io/

babeljs.io
Cat
2019-03-18 13:11:17

*Thread Reply:* cucumber-js docs have some info on this as well - you have to transpile your code if you’re wanting to use import etc.

Madhulika
2019-03-18 16:45:28

*Thread Reply:* I see thank you!

Madhulika
2019-03-18 11:39:40

I tried to fix it by using const { scrollIntoView } = require('scroll-js'); instead of import.. but this did not help

Raymond
2019-03-20 09:52:57

*Thread Reply:* Is it a typescript project?

Madhulika
2019-03-18 11:39:57

any help would be highly appreciated 🙏

Rahul Gupta
2019-03-18 23:24:38

Hi Team i am trying to use rerun functionality in cucumber-js .

Rahul Gupta
2019-03-18 23:26:58

its generating file with location of feature fail with line number , but when i am running with

Rahul Gupta
2019-03-18 23:43:43

but when i am ruining this file i am getting error

Rahul Gupta
2019-03-18 23:44:41

i need to create one script to read this file line by line ?

Rahul Gupta
2019-03-19 01:25:38

i have solve this with adding @ in file name .

Leo
2019-03-19 16:31:18

does anyone here know how I can maybe pass a JSON to my steps file from the feature file?

Cat
2019-03-20 08:30:49

*Thread Reply:* There’s a convo about something similar in this channel - just search in this channel for “json” - it was, I think, 1-2 weeks ago

Leo
2019-03-20 08:56:07

*Thread Reply:* okay sure, let me try searching for it right now

Leo
2019-03-20 09:05:25

*Thread Reply:* @Cat, I see, so instead of passing it from the Feature file what I can do instead is just import it direct from a variable.js file exported as json, which would work in my case since I am not looking for the clients to read it anyways.

Cat
2019-03-20 09:07:13

*Thread Reply:* yep. And if you had multiple files you may need to switch between, you’d just pass in the name (or path + name) of the one you want

Leo
2019-03-20 09:16:53

*Thread Reply:* hm that makes things a bit easier haha

Cat
2019-03-20 09:23:35

*Thread Reply:* What usually helps me when I bump into something that seems ridiculous to implement in cucumber is to step back and go “What am I actually trying to do as a user in this step?” That usually helps you spot the stuff that is too deep into implementation details rather than describing a business use-case step. if what you’re actually needing to do is denote that you are, say, interacting as a particular user profile (e.g., “I am logged in as an admin”), it makes a lot more sense than saying “I send POST /api/login with this JSON: {…}” Same concept 😉

Raymond
2019-03-20 09:55:42

*Thread Reply:* I actually follow the format of passing the name of the file in the feature file into the step

Given I post item "new jacket" into my cart

The step will then clean the string to be newjacket.json and look in the directory "/testData/item/newjacket.json"

It allows a step to be dynamic and allow user readability

Cat
2019-03-20 10:17:35

*Thread Reply:* Thanks. I agree. 😛 https://cucumberbdd.slack.com/archives/C6QJ6N695/p1553098033054900

Cat Minowicz (https://cucumberbdd.slack.com/team/U8ZQLPYRX)
mlvandijk
2019-03-20 11:59:37

*Thread Reply:* If anybody wants to add this to the FAQ in the docs that would be really awesome! It seems to be a question we get more often (and then we can just point them there).

👍 Cat
Cat
2019-03-20 12:07:03

*Thread Reply:* @mlvandijk I’ll see if I can swing some doc updates soon-like

mlvandijk
2019-03-20 12:08:19

*Thread Reply:* 🙏:skintone3:

Cat
2019-03-20 12:10:41

*Thread Reply:* 😄

Raymond
2019-03-20 12:34:04

*Thread Reply:* @Cat ah I didn't see. You are on the case detective.

mlvandijk
2019-03-20 23:18:15

*Thread Reply:* Sidenote: (for strongly types languages,) I'd suggest using domain objects with builder pattern, rather than json files. I mean, why manage json files when you can have (compile time) checks on whether your objects are correct.

Leo
2019-03-19 16:31:42

not as a string but as an actual JSON object?

Raymond
2019-03-20 09:56:14

*Thread Reply:* Read it as a string. Convert it to a json object.

Raymond
2019-03-20 09:56:25

Add helper methods

Gem
2019-03-20 10:08:24

Helper methods are always a solid recommendation!

Leo
2019-03-20 12:09:16

Hi guys

slackbot
2019-03-20 12:09:16

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Leo
2019-03-20 12:10:03

what is a good reporting service to use with cucumberJS and webdriverIO? I tried allure, but it took a really long time to generate reports, so went ahead and moved over to "multiple-cucumber-html" which is actually somewhat janky

Leo
2019-03-20 12:10:07

is there anything else I can use or anything you guys would recommend?

Raymond
2019-03-20 12:33:06

There are other plugins mentioned at the bottom

Leo
2019-03-20 12:36:24

@Raymondbut it seems like most of those are not used for javascript frameworks

Leo
2019-03-20 12:36:39

what do you guys think of this one? https://www.npmjs.com/package/cucumber-html-reporter

npm
Raymond
2019-03-20 16:25:12

*Thread Reply:* I have used that one before. It's good but all depends on your requirements. Also the non javascript ones can still work if you have the jar I believe

Leo
2019-03-21 08:09:10

*Thread Reply:* @Raymond, how did you generate the JSON report for this framework? after creating the JSON report, if you were to have a rerun of all of the tests, how were you able to merge the objects?

Raymond
2019-03-21 09:22:49

*Thread Reply:* I don't follow your question what do you mean merge the objects?

Leo
2019-03-21 10:34:04

*Thread Reply:* @Raymond, let me clarify, so I run my tests one time and the cucumber-json reporter will create one json results object for me, and then say i have re-run logic implemented in my code so when I run it again, it creates a new JSON file for me. So far what I am doing is I am combining them using deep merge and using the result of that to create my html-report. However, the issue with doing that is the deep merge will create duplicates. I wondering if you have done anything similar in the past and if you have then maybe you can point me in the right direction

Leo
2019-03-21 10:36:12

*Thread Reply:* sorry for the long message also btw 🙂 haha

Raymond
2019-03-21 11:55:33

*Thread Reply:* @Leo What is being duplicated?

Leo
2019-03-27 09:13:48

*Thread Reply:* @Raymond, I was able to find a solution for this issue by writing a custom report merger 🙂

Raymond
2019-03-27 10:50:32

*Thread Reply:* 👍

slackbot
2019-03-20 12:36:40

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Gem
2019-03-20 12:57:57

@Leo The best input about a particular tool is likely going to be your own, so give that one a shot and see how it goes. 🙂

Leo
2019-03-20 13:01:26

yes @Gem, love the name by the way, i will try to create my own report 🙂 haha

👍 Gem
Leo
2019-03-20 13:42:32

@Gem, any idea on how I can grab the json from cucumberJS though using webdriverIO? the format property does not seem to work for me

Gem
2019-03-20 13:59:28

@Leo No, sorry. :(

Defrim Hasani
2019-03-22 04:41:26

@Defrim Hasani has joined the channel

Rajeswari
2019-03-23 12:40:35

@Rajeswari has joined the channel

Kalyan Roy
2019-03-25 08:49:03

@Kalyan Roy has joined the channel

Kalyan Roy
2019-03-25 08:50:09

I need help on cucumber integration with puppeteer. I need some documentation or study material. can somebody help me on this?

Aslak Hellesøy
2019-03-25 11:17:49

@Kalyan Roy you can invoke puppeteer functions/methods from Cucumber.js step definitions. Is there anything in particular you’re unsure about?

☝️ Cat
Timbo
2019-03-26 06:58:54

@Timbo has joined the channel

Kalyan Roy
2019-03-26 10:35:22

@Aslak Hellesøy I want to make it configurable. based on some configuration it will take seleniuv-webdriver or puppeteer. So i am searching for any config related file to drive this.

Cat
2019-03-26 11:13:31

*Thread Reply:* That wouldn’t be a pre-built config, precisely. We do something similar by abstracting out the drivers and swapping them in a before hook using tags. Less of a cucumber question and more of an abstract implementation question.

Kalyan Roy
2019-03-26 11:18:37

*Thread Reply:* @Cat Thanks.

Leo
2019-03-29 14:55:56

Hi, i was wondering if there was a way to specifically run certain scenarios by using tags?

Aslak Hellesøy
2019-03-29 15:00:32

@Leo cucumber --tags "@foo or @bar" - see https://docs.cucumber.io/cucumber/api/#running-a-subset-of-scenarios

😁 Leo
Leo
2019-03-29 15:12:54

Thank you very very much @Aslak Hellesøy

👍 Aslak Hellesøy
Leo
2019-04-08 10:09:16

Hi all, is there a way for me to pass a parameter in a before/after hook in cucumberJS?

Gem
2019-04-08 10:10:01

@Leo What’re you trying to accomplish?

Leo
2019-04-08 10:10:13

I am trying to hit a certain endpoint using a beforehook

Leo
2019-04-08 10:10:32

but i wish to pass a parameter through that so that i can use conditional statements to determine which endpoint to hit

Gem
2019-04-08 10:11:27

Can you use environment variables or read in a config file instead?

Gem
2019-04-08 10:11:37

Those are probably your only options

Leo
2019-04-08 10:14:57

hm yes i can

Leo
2019-04-08 10:15:07

i think i will just make it a step iinstead of a hook

Leo
2019-04-08 10:15:14

it will probably make things eaiser haha

Gem
2019-04-08 10:15:45

Possibly, though be careful about exposing too much unneeded detail in your feature file. 🙂

👆 Cat, Leo
Leo
2019-04-08 10:19:02

I will haha

👍 Gem
s2oBcn
2019-04-09 00:21:56

@s2oBcn has joined the channel

s2oBcn
2019-04-09 00:32:37

Hi!, I see that in (cucumber-jvm) JSONFormatter.java, the JSON can print "Keyword":"Scenario Outline" , when an Scenario Outline. But in (Cucumber-js) https://github.com/cucumber/cucumber-js/blob/master/src/formatter/json_formatter.js the Keyword for any scenario is hardcoded as "Scenario".

s2oBcn
2019-04-09 00:33:14

I want to distinguish between both cases.

s2oBcn
2019-04-09 00:33:21

Do you know if "Scenario Outline" as Keyword will be deprecated? Or if I implement the diff for JS could be accepted as a PR?

mlvandijk
2019-04-09 01:34:12

Afaik as of Gherkin 6 Scenario will be a synonym for Scenario Outline. It is already a synonym for Example. In effect the difference will/should disappear as each should run as an individual scenario/example.

s2oBcn
2019-04-09 01:50:50

Exactly, I thought, I read something like this. Thank you! Then I will find another way to solve my problem 🙂

mlvandijk
2019-04-09 05:39:39

Yw. I am curious though what your use case is to know the difference between a scenario and a scenario outline?

mlvandijk
2019-04-09 05:40:03

They should boil down to technically the same thing (a runnable example)

🎯 Cat
Cat
2019-04-09 06:34:28

^^ That was my thought as well

s2oBcn
2019-04-09 08:10:31

🙂

s2oBcn
2019-04-09 08:10:33

I have a process that generates the test cases in Jira, from the execution report, and we use the tags to create fields like "data creation"/"Reviewer".... And we treat as only one testCase all the samples from a Scenario Outline.

s2oBcn
2019-04-09 08:11:40

We have an UUID per scenario that creates a test case in HPALM or Jira

s2oBcn
2019-04-09 08:12:15

Something like this:

s2oBcn
2019-04-09 08:12:22

@InternalTcId:8735e7c4-5f89-45cc-bcc4-d277df05d75f @Author:marta170 @CreationDate:2018-08-08 @Approver:perezlg1 @Reviewer:aparicc1 @ReviewDate:2018-08-09 @Requirement:8774

mlvandijk
2019-04-09 08:15:15

Ah yeah, I figured you might be counting the outline as one test case rather than multiple.

s2oBcn
2019-04-09 08:16:57

The problem here is that as the InternalTcId should be unique, but in scenario outline, we have the same id for all the samples

Cat
2019-04-09 08:24:05

Oh interesting!

tooky
2019-04-09 08:32:49

@s2oBcn Cucumber compiles gherkin into pickles - you can think of a pickle as a test case - each Example table row, applied to a Scenario Outline is a pickle.

It might make sense for your process to use the same model.

mlvandijk
2019-04-09 08:39:00

I'm curious (always): how would you count a scenario outline where some cases pass and some fail?

mpkorstanje
2019-04-09 08:46:46

You can tag rows in the outline IIRC.

tooky
2019-04-09 09:23:39

You can tag examples tables, I don’t think rows.

tooky
2019-04-09 09:24:03

@mlvandijk you get a pass / fail status for each row.

tooky
2019-04-09 09:24:32

the outline doesn’t pass or fail, its not run itself.

🎯 Cat
s2oBcn
2019-04-09 10:37:03

We are in a regulatory environment, where we have a lot of auditories to verify that there are no errors in our code. So have to generate a lot of documentation from our tests, and we only generate this documentation when everything is ok, in the final release. So, at this stage, we can not have any fail. This is the reason why I don't count the fails in a scenario outline... Of course, we have other reports where we can see which one could fail 😉

s2oBcn
2019-04-09 10:38:20

By the way, thank you for your interest and ideas.

mlvandijk
2019-04-09 12:02:12

@tooky yeah, I know. I was curious how @s2oBcn counts them as I was under the impression the outlines were counted as one test case

mpkorstanje
2019-04-09 14:56:52

@mpkorstanje has left the channel

Milena May
2019-04-10 07:19:46

@Milena May has joined the channel

Sushruth R. Gowda
2019-04-11 03:24:21

@Sushruth R. Gowda has joined the channel

Avi
2019-04-12 14:21:00

@Avi has joined the channel

Leo
2019-04-15 18:45:19

can someone help me with an issue i am having with webdriverIO adding a custom command?

Leo
2019-04-15 18:45:34

I know this is for cucumber only, but i was just wondering if someone here would have any experience doing this

Leo
2019-04-15 18:46:35

I am trying to add a custom command in my wdio.conf.js file so that all of my .clicks will wait for the element to be visible first before clicking on the actual element itself. For some reason this is not working for me, can someone please help me find a workout around? thanks in advance!

Cat
2019-04-16 06:50:37

We’ve done something similar, but our implementation is entirely different and probably wouldn’t help much (we use abstracted drivers to switch out as needed). I suggest the webdriverio gitter channel

Leo
2019-04-16 07:50:15

I have just tried the gitter channel, they seemed to be more focused on using v5, which has this feature built in already, but cucumberJS does not have support for v5 yet

Cat
2019-04-16 12:20:34

*Thread Reply:* Incorrect. Cucumber doesn’t care what version of wdio you use. The wdio runner that wraps cucumber, however, has not been updated for wdio v5 compatibility.

Leo
2019-04-16 07:52:15

If you don't mind @Cat, can you show me what you guys have done ?

Cat
2019-04-16 12:25:38

*Thread Reply:* I mean, not immediately because it’s a private repo, I’m on vacation, and I don’t have time to hop on and build a public example repo. ;) But in addition, if you’re using the wdio runner, my implementation is going to be entirely different.

Leo
2019-04-17 18:00:15

*Thread Reply:* @Cat, no worries , I found a work around for this issue by simply just adding an external function even though it may be a bit of a dirty fix it seems to get the job done

slackbot
2019-04-16 07:52:16

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Leo
2019-04-17 17:58:43

does anyone know how to tell if a scenario fails?

Leo
2019-04-17 17:58:51

and then perform some action if that scenario fails?

Cat
2019-04-17 18:11:48

*Thread Reply:* After hooks.

Leo
2019-04-17 18:14:05

*Thread Reply:* in the afterhook, how can i see if a scenario passed of failed? @Cat

Raymond
2019-04-17 18:21:22

*Thread Reply:* After({}, async function(scenario) { scenario.result.status });

Leo
2019-04-17 18:25:47

*Thread Reply:* thank you!

👍 Raymond
Jay
2019-04-23 11:13:25

Hola Cuckes!

Suppose i have a datatable in my step as such where it validates a dynamic message, is there a delimiter that hides the delimiters?

Then the message is &lt;message&gt;
Example:
|message|
|"Field one" is successfully updated|

I want the cucumber output to be displayed as Then the message is Field one is successfully updated

but the field one can change depending on the field being updated

Cat
2019-04-23 12:14:15

*Thread Reply:* Why not just use regex?

Jay
2019-04-23 12:19:26

*Thread Reply:* Hmm...Regex in the feature file?

Jay
2019-04-23 12:19:34

*Thread Reply:* I haven't tried that

Jay
2019-04-23 12:40:42

*Thread Reply:* Dont think i can have regex in feature file.. 😞

Cat
2019-04-24 06:10:23

*Thread Reply:* no, in the step def

Cat
2019-04-24 06:10:51

*Thread Reply:* it would eliminate the need for the quotes in the feature file

Jay
2019-04-24 06:42:59

*Thread Reply:* Ahh i didn't word my question correctly. I already have steps where i am using regex in the step def to read values from feature file.

The question above was, if there was a way to delimit a word in a string. but not show the delimiters in the runtime output.

Cat
2019-04-24 06:56:24

*Thread Reply:* Hm. custom formatter perhaps? https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md

Gem
2019-04-24 08:40:15

*Thread Reply:* What's the end goal you're trying to accomplish? We know the what of what you're trying for, but that doesn't always equate to the end goal.

☝️ Cat
Gem
2019-04-24 08:40:40

*Thread Reply:* If you just want quotes out of it, why is that?

Gem
2019-04-24 08:41:55

*Thread Reply:* If it's just for readability, are the quotes that bad? Could you spin it so that they're meant as an emphasis for what actually matters in the test?

Jay
2019-04-24 09:29:45

*Thread Reply:* The end goal is to have the quotes (or any delimiter) out of it during the runtime. But i will need to check the value within the string matches the code table.

We have different screen, which use the same id for an button element, but depending on when the screen is accessed, the button name can change. The possible names for the button is stored in code table. same goes for any success, warning messages that apprear

Jay
2019-04-24 09:33:15

*Thread Reply:* This is mostly for readability. For example, a message says "BID RATE should be greater than $1000". Here i want to check that BID RATE is in the code table for that screen. right now, i have "<<BID RATE>> should be greater than $1000" and i check the string between << >>.

Cat
2019-04-24 10:29:52

*Thread Reply:* Right, I get that. But it seems like it would be a lot simpler to ditch the delimiters. It’s an awful lot of engineering to ditch them in the output when they could just be avoided entirely.

👍 Jay, Gem
Jay
2019-04-24 10:42:08

*Thread Reply:* @Cat That's true, i am not sure how else i would validate a partial value within a string..and the location is not the same on all messages

Cat
2019-04-24 10:43:25

*Thread Reply:* that’s where the regex comes in 🙂

Jay
2019-04-24 10:44:54

*Thread Reply:* That means i will have multiple steps depending on the location of the value in a string

Jay
2019-04-24 10:46:40

*Thread Reply:* i was looking to create a common steps such as And display success message as follows "BID RATE should be greater than $1000"

Cat
2019-04-24 10:48:27

*Thread Reply:* Right. you can do that in one step.

Jay
2019-04-24 10:48:40

*Thread Reply:* which is what we have right now..except the value to be that needs check is between <<>>

And display success message as follows "&lt;&lt;BID RATE&gt;&gt; should be greater than $1000"

And display success message as follows "&lt;&lt;BID RATE&gt;&gt; is same as &lt;&lt;BID OFFER&gt;&gt;"

Cat
2019-04-24 10:51:14

*Thread Reply:* yeah, you can feed into the stepdef using regex, then in the stepdef (or, probably more extensible, some helper(s)), you’d apply some further regex logic to the params in order to validate

🤔 Jay
:person_doing_cartwheel: Jay
Jay
2019-04-24 10:55:23

*Thread Reply:* let me give it a shot

👍 Cat
Jay
2019-04-24 13:22:49

*Thread Reply:* ok, figured out another way...

Gem
2019-04-24 14:58:16

*Thread Reply:* Getting more comfy with regex is definitely a great skill to have and I'm not even talking about looking ahead or anything like that. Cucumber School has a video on the basic things you'd need to work with Gherkin and it's a pretty short list. Expand on that a little with using something like regex101.com and you'll be pretty powerful!

🎯 Cat
Gem
2019-04-24 15:05:28

*Thread Reply:* Also, is it truly valuable that the actual messages that are output are put in the feature file or are you more concerned that a process was successful? If it's the latter, then move the data check out of the feature file. Your step can then change to a more broad Then the update process will complete successfully and if you really want to, you can run an assertion against the message in a helper file called by the step def.

This way you're removing the headache you're currently facing, removing potentially unuseful data from whoever ends up reading the files, AND you're decoupling yourself from the specific message text at least somewhat. If you want to check the message, you can setup a json file or something and read that in or just do a string.contains(foo). Either way, it lessens the impact on future maintenance which is 👍 🙂

Jay
2019-04-23 11:19:11

not sure if that made sense

Jay
2019-04-23 11:19:47

basically, i want to parse a string with a delimiter, that does not show up in the output.

Jay
2019-04-23 11:21:32

i have this in my feature Then &lt;&lt;Price&gt;&gt; must be greater than or equal to 100.

The out put would be Then Price must be greater than or equal to 100

Raymond
2019-04-24 10:24:55

Has anybody here got much experience with the cucumberjs parallel feature? What I want to do is lazily create and store data across all tests for reuse using a singleton pattern but what happens is that eash of the node containers for each of the parallel runs creates it's own data collection singleton. Is there a way I can set the data to be shared across all containers?

Jason O
2019-04-25 09:34:51

@Jason O has joined the channel

ToddG
2019-04-25 13:16:01

@ToddG has joined the channel

Nick Gonzalez
2019-04-25 13:20:14

@Nick Gonzalez has joined the channel

Padmanabha Raju Sagi
2019-05-01 04:41:00

@Padmanabha Raju Sagi has joined the channel

Kerry N.
2019-05-06 07:20:42

@Kerry N. has joined the channel

Manikandan
2019-05-08 20:42:52

@Manikandan has joined the channel

Greg H.
2019-05-10 08:43:58

@Greg H. has joined the channel

alukian
2019-05-10 10:45:07

@alukian has joined the channel

alukian
2019-05-10 10:49:31

hello, guys could someone please advise me on the following? I've updated to later version of cucumber-js, which is 4.2.1 (previously I was using 1.3.3) Now I am struggling to retrieve some scenario execution data I need to report to TestRail. The kind of data I need:

  • failing step (keyword and name)
  • exception (name and stack)
  • scenario body to synchronize test cases (steps with keywords, including Background steps), etc.

what would be the best way to get all this? previously I was retrieving this in hooks

Lloyd Chang
2019-05-11 00:38:36

@Lloyd Chang has joined the channel

Kerry N.
2019-05-14 15:19:24

I am using a Singleton pattern to register EventEmitter events in my React app. When I test the services which register these events on the Singleton, I am instantiating the services' constructors in the World file. However, I only need certain constructors in each test, not all of them as provided by the World.

I have attempted to use Before hooks to set the constructors I don't need in any given scenario to null but the events are still registered, likely because World is running first.

Is there any way to conditionally instantiate constructors within the world based upon which scenario is running?

Raymond
2019-05-22 12:42:18

*Thread Reply:* If using a singleton pattern then why set it in the world instance? That will register it in every test which defeats the purpose of the pattern. I would recommend registering in the BeforeAll hook, which would mean every test has access to the Emitter

Priya Balan
2019-05-15 08:58:24

@Priya Balan has joined the channel

Priya Balan
2019-05-15 09:24:44

Hi Guys,

Is it possible to view each of cucumber scenario test result with Junit in Eclipse? Atm I’m just able to see the scenario names and not categorised as scenarios as you can see here

Priya Balan
2019-05-15 09:25:40

*Thread Reply:* I would expect something like this

Priya Balan
2019-05-15 09:26:27

*Thread Reply:* I am using cucumber v4.2.0 and junit v4.12. Any suggestions please.

Cat
2019-05-15 09:30:59

*Thread Reply:* May want to check in <#C5YHPPJMP|help-cucumber-jvm>

Priya Balan
2019-05-15 09:35:09

*Thread Reply:* Thanks @Cat

Tomislav Gajsak
2019-05-17 05:15:18

@Tomislav Gajsak has joined the channel

Son Dang
2019-05-20 23:47:02

@Son Dang has joined the channel

Huckleberry
2019-05-21 09:53:45

@Huckleberry has joined the channel

Huckleberry
2019-05-21 09:54:33

so, my cucumberjs hangs after completing all it’s scenarios.

Huckleberry
2019-05-21 09:54:37

I’ve got

Huckleberry
2019-05-21 09:54:54

AfterAll(async function() { // Teardown browser if (this.browser) { await this.browser.close(); } });

Huckleberry
2019-05-21 09:55:01

for my hooks.js

Cardell Pietro
2019-05-22 01:40:58

@Cardell Pietro has joined the channel

Cardell Pietro
2019-05-22 06:44:24

Hi there!

Could you advise are there any sites or repositories with various examples and exercises to practice Cucumber and Gherkin (in JavaScript) ?

Thanks in advance!

P.S. Please do not mention the official documentation 🙂

Cat
2019-05-22 06:55:39

*Thread Reply:* Are you looking for a specific focus? There are some fairly straightforward examples like this one https://www.sitepoint.com/bdd-javascript-cucumber-gherkin/

SitePoint
Cardell Pietro
2019-05-23 06:05:54

*Thread Reply:* Thanks! I'll check it out!

Gem
2019-05-23 09:45:44

*Thread Reply:* Why shouldn't the official documentation be mentioned?

Cardell Pietro
2019-05-24 01:37:51

*Thread Reply:* Because, it is an obvious option 🙂 It doesn't mean that it is not important.

mlvandijk
2019-05-26 01:46:08

*Thread Reply:* What - if anything - are you missing in the official documentation?

☝️ Gem
Hao
2019-05-23 06:48:45

@Hao has joined the channel

Sachin More
2019-05-23 14:09:08

@Sachin More has joined the channel

rajagopal
2019-05-25 04:29:05

@rajagopal has joined the channel

rajagopal
2019-05-25 04:29:12

Can some one help on above qution plz @api @ns Feature: Smoke test @basic @positive [%- INCLUDE "completed/useraccess.feature" %] @basic @advancecase1 [%- INCLUDE "completed/cookie.feature" %] [%- INCLUDE "completed/get_price.feature" %] Scenario: I need some extra logic before next feature file Given that this is required Then i need to enable service [%- INCLUDE 'completed/modify.feature' %] [%- INCLUDE 'verification.feature' %] [%- INCLUDE 'renewal.feature' %] [%- INCLUDE 'autorenew.feature' %] [%- INCLUDE "completed/privacy.feature" %] [%- INCLUDE "completed/password.feature" %] [%- INCLUDE "completed/subuser.feature" %] [%- INCLUDE "completed/lock.feature" %] Scenario: Ones test's are completed Given I need dome extra scenarios for this feature only Then I will include them here. And plz let me know weather this INCLUDE IS usefull or not

Ken Riley
2019-05-27 11:04:31

@Ken Riley has joined the channel

Nathan Jones
2019-05-27 11:58:26

@Nathan Jones has joined the channel

luke
2019-05-31 08:02:58

@luke has joined the channel

luke
2019-05-31 08:03:20

does anyone know the default install location of mocha when you install it via apt-get on bionic?

luke
2019-05-31 08:03:43

trying to get rubymine to play typescript files and it's throwing 1000 errors about runners and suchlike (I'm a bit out of my depth)

Raymond
2019-06-03 18:34:10

Is anyone using cucumberjs in a typescript project and having trouble with the World instance losing its types? I can access the variables stored on the world instance but they all come through as any instead of the types set on the custom world instance when accessing them in step definitions

Raymond
2019-06-03 18:34:39

Any help would be really appreciated ❤️

Leo
2019-06-05 11:21:42

Does anyone know how to mock time?

Leo
2019-06-05 11:21:57

mock in browser time to test time specific actions/behaviors within the browser?

Raymond
2019-06-05 12:08:26

@Leo I'm not sure I follow what your question is

Raymond
2019-06-05 12:08:38

can you provide an example of what you are trying to do

Leo
2019-06-05 12:10:20

I am trying to mock the time in browser

Leo
2019-06-05 12:11:36

So in the application I am testing there is this feature where a certain option should only be visible after 6 PM

Leo
2019-06-05 12:12:12

I wish to inject a time into my browser so I can test for that functionality from an e2e perspective as opposed to unit testing that functionality

Leo
2019-06-05 12:12:17

@Raymond

Leo
2019-06-05 12:12:27

Any ideas on how I can approach this problem?

Cat
2019-06-05 12:23:05

The browser gets the time from the system. You could just mock with Date

Raymond
2019-06-05 12:28:53

@Leo ah okay gotcha. Looks like @Cat has answered ^

Raymond
2019-06-05 12:31:12

One thing, I would say to be careful of it if running in parallel that may cause issues

Leo
2019-06-05 12:38:26

Right that's what I mean @Cat

Leo
2019-06-05 12:38:37

Idk if I can simply modify system time

Leo
2019-06-05 12:38:55

Is there anyway for me to mock browser time only Because it will break others tests when running in parallel

Cat
2019-06-05 13:05:04

Actually, now that i think of it, I think there may be a way to launch the browser driver with a particular time zone. Check the config options for the driver you use.

Leo
2019-06-05 13:30:34

i know that there is a way to launch a browser with a specific timezone @Cat, i am already setting that option in my capabilities for chromedriver haha, but is there a way for me to launch a browser with a specific time?

Cat
2019-06-05 13:34:24

you could use a lib like this one: https://github.com/boblauer/MockDate

Stars
<p>242</p>
Language
<p>JavaScript</p>
Leo
2019-06-05 13:36:44

h mokay

Leo
2019-06-05 13:36:49

I was going to try this one out

Leo
2019-06-05 13:36:50

https://sinonjs.org/releases/v1.17.6/fake-timers/

sinonjs.org
Leo
2019-06-05 13:37:14

but I have been told by others that sinon is a mocking service used for unit testing only and not much can be done for e2e testing with that framework

Cat
2019-06-05 13:48:04

There are definitely cases where sinon can be used to mock things that are basically setup for an e2e case, but if this is your use-case and you don't have a ton of other tests that would lean on sinon, it's almost certainly not worth the setup 🙂

Leo
2019-06-05 13:48:58

so i was able to mock the date

Leo
2019-06-05 13:49:07

i was not able to mock the inbrowser date

Leo
2019-06-05 13:49:44

like the date object in my test is changed during runtime, but the in browser time (which grabs the time from my system time) is not modified and

Leo
2019-06-05 13:49:50

it still displays the local time

Cat
2019-06-05 14:02:33

Hm. My suggestion would be to either test it at a lower level so you can mock it, or run on VM so that modification of the system time won't impact other tests.

Leo
2019-06-05 14:04:32

test it at a lowe rlevel?

Leo
2019-06-05 14:04:34

what do you mean by that?

Cat
2019-06-05 14:05:09

functional rather than e2e (but higher than unit)

Leo
2019-06-05 14:11:04

would i need access to the source code for functional testing?

Leo
2019-06-05 14:11:09

no right

Leo
2019-06-05 14:18:33

@Cat what do you think of this article right here

Leo
2019-06-05 14:18:34

https://markus.oberlehner.net/blog/network-stubs-and-timers-with-nightwatch-and-cucumber/

markus.oberlehner.net
Leo
2019-06-05 16:26:27

@Cat is it possible to user nodejs to inject javascript into the html headers of an application?

Cat
2019-06-05 16:42:19

Can you give an example of what you mean as opposed to naked JS?

Cat
2019-06-05 16:42:48

Because node can do TONS of fancy stuff, but the browser isn’t a node environment ;)

Leo
2019-06-05 16:45:36

something liek this

Leo
2019-06-05 16:46:06

browser.execute( javascript to inject lolex into DOM of application )

Leo
2019-06-05 16:46:55

because that is basically what that article is doing, except in my case, i dont actually access to "index.html" so i cannot simply just spin up a test server and have it inject timer.js into my header @Cat

Cat
2019-06-05 16:48:13

You can totally do browser.execute 🤷‍♀️:skintone2:

Leo
2019-06-05 16:50:03

hmm, what would be the native javascript to inject lolex though

Leo
2019-06-05 16:54:15

@Cat I basically want to inject this script into my application under test during runtime, without actually having access to the applications source code however

Nick Gonzalez
2019-06-05 17:08:39

Hey. I am running my tests with cucumber-html-reporter and I am unable to take a screenshot and attach it to be the report https://github.com/gkushang/cucumber-html-reporter Following the instructions, I receive the following error "world.attach is not a function"

Stars
<p>138</p>
Language
<p>HTML</p>
Raymond
2019-06-06 10:04:47

*Thread Reply:* Make sure you are passing in params to your custom world instance constructor and then make sure to create this.attach = params.attach

Nick Gonzalez
2019-06-05 17:09:30

cucumber: 5.1.0

Nick Gonzalez
2019-06-05 17:10:03

Is there a better way to attach a screenshot to an html reporter?

Leo
2019-06-05 18:05:35

So, I think I am on the right track, but I am still not able to figure it out, i have posteed a stack overflow question here, any help would be greatly appreciated!!!

Leo
2019-06-05 18:05:36

https://stackoverflow.com/questions/56469785/how-to-use-inject-fake-timers-to-simulate-fake-dates-and-times-in-browser-using

Stack Overflow
Andy Nguyen
2019-06-05 22:36:03

@Leo Here is a suggestion that I will know will work, but it is up to you if it is worth the effort (It is similar to Cat's suggestion about using a VM). Create a docker container, set the system time of that container, and run the corresponding tests within that container. Would make your test truly E2E, as from what I have read, the browser gets system time from the OS (and not the browser). Otherwise for simplicity, test the time functionality at a unit or integration level. Example: If you were using React, render the page with a mocked out time, and see if the DOM matches what you were expecting.

Andy Nguyen
2019-06-05 22:40:45

@Nick Gonzalez Where did you place your ... world = this variable? "world.attach is not a function" error might be occurring, because "this" can correspond to a different context depending on where you place that line in the code.

🎯 Cat
Leo
2019-06-06 08:42:47

@Andy Nguyen, I'm not sure if I would be able to render the page with a mocked out time, because I don't think I have access to the src code

luke
2019-06-06 08:48:15

@luke has left the channel

Raymond
2019-06-06 10:06:56

@Leo Can you share the html for this hide/display element

Leo
2019-06-06 10:08:00

I am only testing the application, I do not access to the source code, but what I can do is give you the html from the chrome inspector @Raymond

Raymond
2019-06-06 13:17:59

*Thread Reply:* Yep that would be helpful. You may be able to override the value being used if it's being done on the frontend

Nick Gonzalez
2019-06-06 10:45:45

@Andy Nguyen The this is happening in the After function of the World.js file

Raymond
2019-06-06 11:19:23

@Nick Gonzalez https://cucumberbdd.slack.com/archives/C6QJ6N695/p1559840687040800?thread_ts=1559779719.027600&cid=C6QJ6N695

Raymond (https://cucumberbdd.slack.com/team/UG2MNPE3G)
Nick Gonzalez
2019-06-06 11:28:47

@Raymond like so? setWorldConstructor(CustomWorld, this);

Raymond
2019-06-06 12:43:38

*Thread Reply:* @Nick Gonzalez no it would be in the CustomWorld constructor

Raymond
2019-06-06 12:44:19

*Thread Reply:* export class CustomWorld { protected constructor(params) { this.attach = params.attach; } protected attach; }

Raymond
2019-06-06 12:44:24

*Thread Reply:* something like this ^

Nick Gonzalez
2019-06-06 13:19:30

*Thread Reply:* My custom world is not a class. It is a function function CustomWorld(callback) { this.driver = new webdriver.Builder().forBrowser("chrome").build(); }

Raymond
2019-06-06 14:15:59

*Thread Reply:* Okay try the following function World({attach, parameters}) { this.attach = attach; this.parameters = parameters; this.driver = new webdriver.Builder().forBrowser("chrome").build(); } setWorldConstructor(CustomWorld)

Leo
2019-06-06 11:55:29

does anyone have a good wiremock tutorial i can follow?

Leo
2019-06-06 11:55:34

or does anyone here use wire mock?

Raymond
2019-06-06 13:17:21

@Nick Gonzalez check the threads in your comment ^ I have replied

Roger Anderson
2019-06-10 21:18:03

@Roger Anderson has joined the channel

tobiasdoll
2019-06-10 23:47:27

@tobiasdoll has joined the channel

tobiasdoll
2019-06-11 01:49:35

Hey, I made a small sample project for how to use the pageObject pattern with cucumber.js. I thought maybe someone on here could use that as well. You can check it out on https://github.com/tobysoby/cucumber-js_pageObjects_example All feedback is welcome of course! 🙂

Language
<p>JavaScript</p>
Last updated
<p>2 hours ago</p>
Raymond
2019-06-11 10:12:23

*Thread Reply:* @tobiasdoll You have put page objects under the feature directory, that is bad practice. They should go under a page directory or a step definitions directory

tobiasdoll
2019-06-11 23:08:54

*Thread Reply:* @Raymond thanks for that. But why exactly is that bad practice? Can't all test code live in features? (Like in the official nodejs example, see https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md)

Raymond
2019-06-12 09:44:12

*Thread Reply:* @tobiasdoll The feature folder should include only feature files and no ts/js/** code. The code such as steps / pages should live in their own folder as it muddys the water putting everything into the same folder.

Jon Beller
2019-06-11 06:51:31

@Jon Beller has joined the channel

Nick Gonzalez
2019-06-11 09:28:21

Is there a way to include an integer in a feature's scenario without it passing to the step definition?

Aslak Hellesøy
2019-06-11 09:55:26

I’m not sure I understand your question @Nick Gonzalez. How would you access it from the step definition if it’s not passed to it?

Nick Gonzalez
2019-06-11 09:56:22

@Aslak Hellesøy I know it sounds strange, but the particular phrase that I'm using in the scenario merely has a number in it

Nick Gonzalez
2019-06-11 09:57:06

EX: Given I am on the 1800Flowers website

Aslak Hellesøy
2019-06-11 09:57:21

Ok? So just repeat that number in the stepdef’s expression rather than making it a parameter.

Aslak Hellesøy
2019-06-11 09:57:44

You don’t have to use the stepdef cucumber suggests. You can edit it/write your own.

Nick Gonzalez
2019-06-11 09:58:03

Ah ok. thank you

Leo
2019-06-11 10:32:00

Hi guys, I have a question

slackbot
2019-06-11 10:32:00

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

👍 Raymond
Raymond
2019-06-11 10:52:14

*Thread Reply:* @Leo

Leo
2019-06-11 10:32:37

Is it possible in CucumberJS, to pro-grammatically TAG the failed scenarios, and then have the framework RERUN only the failed scenarios with a certain tag?

Leo
2019-06-11 10:33:17

I have a few flaky scenarios that sometimes fail and sometimes do not fail due to application network issues, and I was wondering if there was a way for me to rerun only those failed scenarios on a second or even a third retry sometimes

Leo
2019-06-11 10:40:56

If not that^ is there a built in rerun feature that cucumberJS offers?

Raymond
2019-06-11 10:52:06

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#formats Rerun

Leo
2019-06-11 10:53:09

*Thread Reply:* is this something I can do with the wdio-cucumber-js framework? @Raymond

Raymond
2019-06-11 11:05:24

*Thread Reply:* @Leo can you link me that repository and I can take a look

Leo
2019-06-11 11:07:32

*Thread Reply:* @Raymond https://github.com/webdriverio/wdio-cucumber-framework#cucumberopts-options

Stars
<p>73</p>
Language
<p>JavaScript</p>
Leo
2019-06-11 11:08:09

*Thread Reply:* I am going to try to pass the retry logic as a cucumberOption right to see if that will work for me, even though i couldn't find it in the documentation from that link

Leo
2019-06-11 11:21:57

*Thread Reply:* this is what my cucumberOptions look like

cucumberOpts: { tagExpression: '@QA', format: [ 'rerun:@rerun.txt' ] } }

Raymond
2019-06-11 11:23:27

*Thread Reply:* Looks correct to me

Leo
2019-06-11 11:30:02

*Thread Reply:* yea, it's not working for me

Raymond
2019-06-11 11:38:37

*Thread Reply:* Okay if I get some time later after work I can look

Leo
2019-06-11 13:53:01

*Thread Reply:* okay, thank you @Raymond!

Leo
2019-06-12 14:17:20

*Thread Reply:* so after doing alot of research yesterday, I figured out why it was not working for me. It is due to this issue: https://github.com/webdriverio/wdio-cucumber-framework/issues/6 , webdriverIO apparently blocks cucumberJS reporters, and because of that , I am not able to format the rerun.txt file. However, I was able to find a work around by having my automation retry entire failed feature files instead. It takes a bit longer, but definitely gets the job done. Anyway, thanks for your help!

ricoli (https://github.com/ricoli)
Comments
7
Gem
2019-06-11 11:01:16

@Leo Cucumber does support rerunning failed scenarios. 🙂 I’m not sure about using it with the wdio-cucumber-js however. I’m not familiar with that.

One thing I will add that’s tool independent though, is that you should be much more concerned with improving the flake tests. Improving the resiliency of your tests with things like network failures is hugely important as they should not be failing for things outside of what’s being tested. Also, you risk losing team confidence in test failures which defeats the purpose of having them in the first place.

🎯 Raymond, mlvandijk, Leo
Roger Anderson
2019-06-11 21:47:32

hello All

Roger Anderson
2019-06-11 21:47:46

i am facing timeout issue while navigate to another page

Roger Anderson
2019-06-11 21:48:35

i am using cucumber js and seleneium webdriver latest version

Roger Anderson
2019-06-11 21:48:39

but wait function not accepting more

Roger Anderson
2019-06-11 21:48:51

could you please give us code for same

Roger Anderson
2019-06-11 22:08:11

UnhandledPromiseRejectionWarning: NoSuchElementError: Unable to locate element: **[id="btnLogout"]

Roger Anderson
2019-06-11 22:08:16

got this eeror

mlvandijk
2019-06-12 03:19:51

That means the element with the mentioned id is not available at the moment the test is looking for it. You might need to wait for it to become available (using a fluid wait, not a sleep) or use a different locator.

🎯 Gem, Cat
Trisha
2019-06-14 01:20:31

@Trisha has joined the channel

Kostas
2019-06-18 04:20:54

Apologies if it's been mentioned before, but what is the best solution for cucumber reports when running tests in parallel? The default option outputs the steps results as soon as they complete, which works fine in serial but not so well in parallel.

Jimmy
2019-06-21 05:23:42

@Jimmy has joined the channel

Jimmy
2019-06-21 05:34:30

Hi All. I'm starting with CucumberJS but only see examples using the assert built-in module or chai. I'm currently using Jest for unit testing. I've doing some research about integrating CucumberJS and Jest and found a couple libraries, unfortunately don't see to work well.

How do you people work with that? Should I use two different libraries for testing? or migrate to chai in order to support my step definitions? Also I'd like to see some example projects with JS doing so. Thank you very much.

Cat
2019-06-21 06:05:03

*Thread Reply:* Short answer to "How do you people work with that?": I don't. 🤷 Long answer: Any time "my unit tests are in x so I want to keep using x with cucumber" is typed, god kills a kitten. When we write BDD tests like unit tests - to the point of wanting to retain our unit testing framework - it tends to result in tests that are also designed like unit tests, which lends itself to being nothin-but-anti-patterns when it comes to testing that is above unit level. My suggestion (and what I and my team do) would be to use an assertion framework that plays nicely with Cucumber (we use chai here). You can try to figure out something with jest, but imo, it's a lot faster to just use an assertion framework 🤷

Jimmy
2019-06-21 08:00:29

*Thread Reply:* You're right, Cat. Faster and easier. Thank you so much for you advice.

Shamyla
2019-06-24 14:14:24

@Shamyla has joined the channel

David Tran
2019-06-24 14:18:14

@David Tran has joined the channel

Kostas
2019-06-25 02:05:07

Can the running order of cucumber-js hooks be configured somehow? I tried using what was suggested here, but without much luck... https://www.toolsqa.com/cucumber/execution-order-hooks/

TOOLSQA
Cat
2019-06-25 04:13:19

*Thread Reply:* If I recall, before hooks run sequentially - after hooks are reverse sequence.

Kostas
2019-06-25 08:08:25

*Thread Reply:* So the top before hooks run first and the top after hooks run last?

Cat
2019-06-25 08:21:23

*Thread Reply:* Yep. Have a look at the docs: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md

👍 Kostas, mlvandijk
Gilad
2019-06-25 05:35:04

@Gilad has joined the channel

Sivakumar Narayanan
2019-06-26 02:37:20

@Sivakumar Narayanan has joined the channel

Kostas
2019-06-26 06:42:31

Is the timeline-formatter available in cucumber-js? https://cucumber.io/docs/guides/parallel-execution/#timeline-formatter

Shamyla
2019-06-27 14:06:01

Hiya 👋 Can I use Cucumber with CypressIO ?

Gem
2019-06-27 14:09:24

*Thread Reply:* Yep! Try googling “cucumber and cypressio” 🙂

Shamyla
2019-06-27 14:11:40

*Thread Reply:* I did 😅

🎉 Gem
Shamyla
2019-06-27 14:11:57

*Thread Reply:* but I wasn't sure what was the official offering

👍 Gem
Cat
2019-06-27 14:13:07

*Thread Reply:* There's no "official" offering, to my knowledge. There's a cucumber pre-processor for cypress.

👍 Gem
Shamyla
2019-06-27 14:13:09

*Thread Reply:* I see cucumber plugins for Cypress here > https://docs.cypress.io/plugins/index.html

Shamyla
2019-06-27 14:13:46

*Thread Reply:* @Cat oh I see!

Shamyla
2019-06-27 14:14:06

*Thread Reply:* I'll check that out then, thanks!

Gem
2019-06-27 14:18:03

*Thread Reply:* Here’s more info around official and other offerings of Cucumber. 🙂 https://cucumber.io/docs/installation/

👍 Shamyla
dodo
2019-07-01 01:42:19

@dodo has joined the channel

Jörg Bergner
2019-07-03 05:46:03

@Jörg Bergner has joined the channel

Jörg Bergner
2019-07-03 05:47:07

Hi! Our Customers want to write features in German. I know that I have to use #translate: de. - That works in my IntelliJ Idea without any problems. But if I create the step definitions I’m getting following errors:

Jörg Bergner
2019-07-03 05:47:20

e2e/src/features/step_definitions/app-test.steps.ts(3,10): error TS2305: Module '"../../../../../../../../Users/joerg/Werkstatt/leia/node_modules/@types/cucumber"' has no exported member 'Angenommen'. e2e/src/features/step_definitions/app-test.steps.ts(3,30): error TS2305: Module '"../../../../../../../../Users/joerg/Werkstatt/leia/node_modules/@types/cucumber"' has no exported member 'Dann'. e2e/src/features/step_definitions/app-test.steps.ts(3,36): error TS2305: Module '"../../../../../../../../Users/joerg/Werkstatt/leia/node_modules/@types/cucumber"' has no exported member 'Wenn'.

Jörg Bergner
2019-07-03 05:53:44

Maybe that pic helps to verify the error:

Cat
2019-07-03 05:58:52

*Thread Reply:* If I'm not mistaken, the gherkin can be in any language, but the step definitions would still call the same things (e.g., Given, When, Then). alternatively, you can use defineStep. But it looks like you're trying to import things that don't exist in the cucumber library.

Jörg Bergner
2019-07-03 06:09:08

*Thread Reply:* I thought, if my IDE is giving me that file, I can use it as it is.

tooky
2019-07-03 06:28:20

*Thread Reply:* That looks like it might be a bug in either the IDE or the snippet generation. How was the file created?

JavaScript will allow this to work though! You can change line 3 to:

import { Given as Angenommen, Before, Then as Dann, When as Wenn } from 'cucumber';

😄

🎯 Cat, Gem, Jörg Bergner
👍 Jörg Bergner, tobiasdoll
Cat
2019-07-03 06:28:36

*Thread Reply:* was just about to type this ^^

💪 tooky
Raymond
2019-07-03 09:58:42

*Thread Reply:* Isn't is the other way around? import { Angenommen as Given, Before, Dann as Then, Wenn as When } from 'cucumber';

Raymond
2019-07-03 09:59:42

*Thread Reply:* Ah seems on imports it's the other way around. I learned something today 😄 thanks @tooky

Cat
2019-07-03 10:02:03

*Thread Reply:* See?! Everybody learns up in here! https://media.giphy.com/media/3og0IMJcSI8p6hYQXS/giphy.gif

😂 Raymond, tooky
dimliaro
2019-07-03 06:35:41

@dimliaro has joined the channel

luke
2019-07-03 06:47:11

@luke has joined the channel

Ryan Kazokas
2019-07-03 07:57:54

@Ryan Kazokas has joined the channel

dimliaro
2019-07-04 07:54:17

Hi, I want to create a cucumber-html-reporter and take a screenshot of the results. Is anyone willing to give me a hand ? Like with a simple cucumber scenario

Jay
2019-07-04 08:01:33

*Thread Reply:* Screenshot at the last step or screenshot at the failed step?

dimliaro
2019-07-04 08:02:52

*Thread Reply:* Screenshot at any point 😄 I am new to this and I do expirements

Jay
2019-07-04 08:04:05

*Thread Reply:* you can use browser.takeScreenshot()

dimliaro
2019-07-04 08:05:58

*Thread Reply:* I run my index.js file with node index.js and I get an error that takeScreenshot is not a function 😕

Jay
2019-07-04 08:06:01

*Thread Reply:* Then you will need to parse the image data

imageStream.write(new Buffer(data, "base64"));
            imageStream.end();
Jay
2019-07-04 08:09:48

*Thread Reply:* here is a screenshot at failure implementation

if (scenario.status === "failed") {
            await browser.takeScreenshot()
                .then(async function (screenshot) {
                    decodedImage = screenshot
                    await saveScreenshotToLocal(scenario, screenshot)
                })
        }

 export async function saveScreenshotToLocal(scenario, screenshot) {
        const fs = require("fs");
        const path = require("path");
        const dir = "./e2e/reports/screenshots";

        const now = new Date()
        const hours = (now.getHours() &lt; 10 ? "0" : "") + now.getHours()
        const mins = (now.getMinutes() &lt; 10 ? "0" : "") + now.getMinutes()
        const sec = (now.getSeconds() &lt; 10 ? "0" : "") + now.getSeconds()
        const ts = now.toISOString().replace(/\T.**$/, "").replace(/-/g, "") + "_" + hours + mins + sec

        //create folder screenshots, if it doesn't exist
        if (!fs.existsSync(dir)) {
            fs.mkdirSync(dir)
        }

        // Writing screenshot to a file
        function writeScreenShot(data, filename) {
            const imageStream = fs.createWriteStream("./e2e/reports/screenshots/" + filename);
            imageStream.write(new Buffer(data, "base64"));
            imageStream.end();
        }
        const featureFileName = ((scenario.scenario.uri).split(path.sep))
        writeScreenShot(screenshot, featureFileName[featureFileName.length - 1] + "-line" + scenario.scenario.line + "-" + ts + ".png")
    }
dimliaro
2019-07-04 08:11:38

*Thread Reply:* So I have this taken from internet. Should I add ur part in there?

Jay
2019-07-04 07:58:06

Hi Everyone, Is there any cucumber reports where it reports by tag? for ex: @defect - 32 failed, 2 passed and so on

Alok Takshak
2019-07-04 08:08:49

@Alok Takshak has joined the channel

dimliaro
2019-07-04 08:20:37

Is anyone familliar with CukeTest?

Aslak Hellesøy
2019-07-04 09:08:11

*Thread Reply:* @dimliaro never heard of it

dimliaro
2019-07-06 05:19:03

*Thread Reply:* So it must be a joke-app. I tried to download it, because it was like an enviroment especially for cucumber, and no matter how many times I click on Download it'll never does anything. So it may be a fraud 😛

dimliaro
2019-07-06 10:04:12

Does anyone has to suggest me a tutorial when I can easily make a cucumber html report ?

Cat
2019-07-06 11:39:16

*Thread Reply:* Should be covered in the docs - if you need something additional, look at npm for cucumber html reporter

Dónal Troddyn
2019-07-07 11:45:34

@Dónal Troddyn has joined the channel

dimliaro
2019-07-08 06:16:34

Why I keep getting "cucumber command not found" when I try to run cucumber? 😕 I've installed it with these commands

  1. npm install cucumber --save-dev
  2. npm install -g cucumber
Cat
2019-07-08 06:18:16

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md

Ditch the global installation.

dimliaro
2019-07-08 06:22:15

*Thread Reply:* So should I uninstall cucumber and re-download it but not globally

Cat
2019-07-08 06:23:37

*Thread Reply:* global uninstall (if you aren't familiar with that, check the npm docs). Install it at the project level - npm i cucumber or npm i cucumber --save-dev is fine

Cat
2019-07-08 06:26:35

*Thread Reply:* then you can just follow the instructions from that doc I linked

dimliaro
2019-07-08 06:39:26

*Thread Reply:* Sooo.. that worked! Now I want to make a html cucumber report and although I follow the steps at https://www.npmjs.com/package/cucumber-html-reporter I keep getting error Unable to parse cucumberjs output into json: './htmlreport/hellocucumber/nodemodules/package.json' Error: ./htmlreport/hellocucumber/nodemodules/package.json: ENOENT: no such file or directory, open './htmlreport/hellocucumber/node_modules/package.json'

Any suggestions?

Cat
2019-07-08 06:41:20

*Thread Reply:* uh. the package.json isn't inside of node_modules

dimliaro
2019-07-08 06:42:29

*Thread Reply:* Unable to parse cucumberjs output into json: './htmlreport/hellocucumber/package.json' Error: ./htmlreport/hellocucumber/package.json: ENOENT: no such file or directory, open './htmlreport/hellocucumber/package.json'

dimliaro
2019-07-08 06:42:47

*Thread Reply:* That's the one 😛 Same results

dimliaro
2019-07-08 06:43:07

*Thread Reply:* I acutally added ./node_modules after this error

Cat
2019-07-08 06:43:58

*Thread Reply:* ... what? You don't need to add node_modules. npm creates that

dimliaro
2019-07-08 06:45:15

*Thread Reply:* I'm learning 😛 But, still the main error keeps showing itself

Cat
2019-07-08 06:45:30

*Thread Reply:* I would recommend deleting your node_modules folder, run npm i from the project directory, and then looking at the configuration docs for the formatter you're using

dimliaro
2019-07-08 06:48:55

*Thread Reply:* FML I don't get it. I'll study more and come back to retry 😜

Cat
2019-07-08 07:05:23

*Thread Reply:* It's a lot if you aren't familiar with npm 🙂

dimliaro
2019-07-08 07:06:37

*Thread Reply:* Yeah, I guess I dived into the deep stuff too early 😛

Cat
2019-07-08 07:09:32

*Thread Reply:* nah, you just don't have muscle-memory for debugging npm yet 😂

dimliaro
2019-07-08 07:10:54

*Thread Reply:* 😂 Anyway, thanks for your time and your help, I really appreciate it! Farewell Cat 😻

👍 Cat
dimliaro
2019-07-09 04:02:21

Why every video about cucumber-html-reporter in YT is for java? No one wants to do it with JS?😑

Cat
2019-07-09 04:09:39

*Thread Reply:* Just check npm for the reporters. The README will be pretty straightforward

Aslak Hellesøy
2019-07-09 16:46:04

@dimliaro we’ll soon start working on a new HTML reporter that will work across all Cucumber implementations. And hopefully a lot better than the existing implementations.

👍 tobiasdoll, Ayethin, Raymond, Dónal Troddyn
dimliaro
2019-07-10 01:34:26

@Aslak Hellesøy Nice! I'll stay tuned 😄

comolokko
2019-07-10 04:09:20

@comolokko has joined the channel

dimliaro
2019-07-10 04:26:23

Sooo, I did manage to create a cucumber-html-report by following instructions on the internet. Well, thats what I thought... I ran :

  1. ./node_modules/.bin/cucumber-js —format json:./htmlreport/hellocucumber/cucumber-json-report.json AND
  2. /node_modules/.bin/cucumber-js —format json:./htmlreport/hellocucumber/cucumber-html-report.html

And the results are that I have the same file but with different name and filename.type.

Despite the fact that that's not a problem, my goal was to create a bootstrap pie scheme that shows me stuff. And though I thought that when I ran it, a window will appear and show me the pie scheme that I saw on the internet. But that never happened.

I don't know if any of you can help me or give me a thought, but If you read this I thank you for spending time even reading it 😛 PEACE

Cat
2019-07-10 05:26:21

*Thread Reply:* you could just run npm run yourTestScript &amp;&amp; open yourHtmlOutput.html

Cat
2019-07-10 05:27:11

*Thread Reply:* (you'd need to use npm-run-all dependency if you want to execute that from your package.json)

Martin Fabián
2019-07-10 06:54:57

@Martin Fabián has joined the channel

dimliaro
2019-07-11 05:43:51

Hi, I am trying to use click method for a scenario to pass. If I was JS what commands would I use? 😛

Cat
2019-07-11 05:47:08

*Thread Reply:* That's not a cucumber question - it depends on your driver.

dimliaro
2019-07-11 05:49:20

*Thread Reply:* Well, technically I want to implement in js this scenario: Scenario: Given that I have gone to the intelligencia page When I click on Request a Demo Then I should see a picture

And I can't do the Given part, when I use click() , i am getting error click is not a function

dimliaro
2019-07-11 05:49:44

*Thread Reply:* Forget the Then part though 😜

Cat
2019-07-11 05:50:08

*Thread Reply:* Right. Cucumber doesn't click for you

Cat
2019-07-11 05:50:57

*Thread Reply:* Cucumber doesn't give a shit WHAT you're doing 😛 you have to tell it what you're doing.

dimliaro
2019-07-11 05:51:23

*Thread Reply:* So, you don't know how I can do da click ? 😞

Cat
2019-07-11 05:51:56

*Thread Reply:* Yes, but not in cucumber because cucumber does not click anything. 😛 I can tell you how to click in webdriverio

dimliaro
2019-07-11 05:52:30

*Thread Reply:* Ok, can I show you my stepdef.js?

Cat
2019-07-11 05:53:02

*Thread Reply:* You can, but again, this isn't a cucumber issue

dimliaro
2019-07-11 05:53:34

*Thread Reply:* Ok I'll remove the thread afterwards 😛

dimliaro
2019-07-11 05:53:37

*Thread Reply:* // #/Users/dimitrisliaropoulos/Desktop/htmlreport/hellocucumber/features/step_definitions/stepdefs.js var {setDefaultTimeout} = require('cucumber'); setDefaultTimeout(60 ** 1000); const assert = require('assert'); const { Given, When, Then } = require('cucumber'); const {Builder, By} = require('selenium-webdriver'); let driver = new Builder().forBrowser('chrome').build(); var chrome = require('selenium-webdriver/chrome');

function clicky(){ document.getElementById("nav-request-demo").click(); }

Given('that I have gone to the intelligencia page', async function() { await driver.get('https://www.intelligencia.ai'); }); // When('I click on Request a Demo', async function() { await driver.getElement(By.linkText("nav-request-demo")); }); // by class? Then('I should see a picture', async function() { driver.findElement(webdriver.By.class("hero-img-2 section")); });

Cat
2019-07-11 05:56:55

*Thread Reply:* function clicky(){ document.getElementById("nav-request-demo").click(); } you're using document and not driver which probably doesn't help 🤷

dimliaro
2019-07-11 05:57:53

*Thread Reply:* I was using diver berfore 😛 then i googled searched. I saw the document.blahblah and threw it in

dimliaro
2019-07-11 05:58:11

*Thread Reply:* So even with driver it doesnt work

Martin Fabián
2019-07-11 07:17:08

Hi folks, how would you do this. I have page where is dynamic content which is table that is filled with data. Let´s say that I have 5 columns but I can have 1 row or 10 rows depends on number of data. I need to check some item row. Example. - this table is filled with service requests. Each has own unique ID but other fields can be the same. How can I check that service request that is on second like has correct last item in table. Last item can be for example 5th row. I cannot set up fixed selector cause this table is dynamic but I need to check that 5th item in this table is let´s say with some icon like urgent icon.

Martin Fabián
2019-07-11 07:21:04
luke
2019-07-11 07:22:42

Sounds like you just need to enumerate lal your data using a forEach in js

Martin Fabián
2019-07-11 07:23:21

Shell I set up selector for <tr> then list through all <td> and with forEach check content like innerText and then compare it?

luke
2019-07-11 07:35:43

however you think is best.

If it's data available on a website. I'd store the original dataset and then sanitize it.

Martin Fabián
2019-07-11 07:39:12

yae ok I will try to deal with it. Hard task..

luke
2019-07-11 08:56:40

try break it down into smaller tasks. get all elements get all text sanitize all text

AnjaliGarg
2019-07-14 22:56:17

@AnjaliGarg has joined the channel

AnjaliGarg
2019-07-14 22:58:02

Hi I just want to check can we use cucumber with siesta and if we can use then how to use please reply?

Alexander Foxleigh
2019-07-15 01:11:04

@Alexander Foxleigh has joined the channel

Alexander Foxleigh
2019-07-15 01:13:52

Hey sorry for posting this here and in #help but I didn't know this channel existed until this morning:

Hi everyone, I'm fairly new to cucumber (beyond the basics) so please forgive me if this is a simple issue.

I'm trying to create a new ParameterType which I've set up using the following JS code:

defineParameterType( new ParameterType( 'actor', /Robert Price|Test User/i, Actor, name =&gt; new Actor(name) ) )

However I get the error ParameterType Regexps can't use flag 'i', flags are not THAT important to me as I can get around that so I tried removing the flag and now I get TypeError: Cannot read property 'flags' of undefined, I can't figure out a way around this but I think I've narrowed it down to the regexpFlags function in cucumber-expressions/src/parameter_types.js.

Has anyone seen this issue before and if so, do you know what the work-around is?

If it helps, I just did a console.log on the regexp parameter and I'm getting this if I try to run it without flags: /-?\d+/ /\d+/ /-?\d**\.\d+/ /[^\s]+/ /"([^"\\]**(\\.[^"\\]**)**)"|'([^'\\]**(\\.[^'\\]**)**)'/ /.**/ /Robert Price|Test User/ undefined

I have no idea where that undefined is coming from (also no idea where the stuff before my actual regex is coming from either but I suspect it's the undefined that's causing me problems)

with the flag I get the same output except that /Robert Price|Test User/ prints as /Robert Price|Test User/i and there is no undefined line.

Aslak Hellesøy
2019-07-19 03:56:47

*Thread Reply:* Hi @Alexander Foxleigh - the reason you cannot use flags is that the parameter type’s regexp will be merged into a bigger regexp covering the entire step text. Allowing flags such as i would then apply to the entire regexp, which would be undesireable. For example there might be another parameter type for currencies with regexp [A-Z]{3} and we don’t want that to match gbp, only GBP.

Aslak Hellesøy
2019-07-19 03:57:35

*Thread Reply:* As for the error you’re seeing - I’m not sure. What Node.js version are you running this on?

Aslak Hellesøy
2019-07-19 03:58:59

*Thread Reply:* Also, what version of cucumber-expressions do you have in your package-lock.json or yarn.lock?

Aslak Hellesøy
2019-07-19 04:00:23

*Thread Reply:* In order to help you and fix this bug it would also be useful to see a stack trace. Please create a new issue at https://github.com/cucumber/cucumber/issues

Aslak Hellesøy
2019-07-19 04:00:57

*Thread Reply:* The more detail you add, the higher the chances of someone picking up the issue to fix it.

Aslak Hellesøy
2019-07-19 04:02:03

*Thread Reply:* If you submit a pull request with a test that reproduces the bug that would be great!

Alexander Foxleigh
2019-07-19 05:28:33

*Thread Reply:* Will do, thanks @Aslak Hellesøy

Alexander Foxleigh
2019-07-19 07:04:27

*Thread Reply:* @Aslak Hellesøy I think the problem is that the team I'm on are using the cucumber-boilerplate library which inexplicably has 3 different versions of cucumber-expressions installed, plus there is a lot of black-box stuff going on behind the scenes which I can't debug. So until I can bully them into dropping boilerplate, I think we're stuck, I'll just have to work around it.

Aslak Hellesøy
2019-07-19 07:17:32

*Thread Reply:* Yuck! I see they reimplemented the training wheels I tossed 8 years ago. This stuff just won’t die! https://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off

Aslak Hellesøy
😂 Alexander Foxleigh
dimliaro
2019-07-15 03:23:43

Hello fellas, quick and maybe stupid question:

If, for any reason, I have in a feature file two different scenarios with the same Given and on the "stepdef.js" file I write it only once, will it run Given two times?

As an example I could imagine this: Scenario: 1 Given I am on a website When I do stuff Then stuff happens

Scenario: 2 Given I am on a website When I do other stuff Then other stuff happens.

Like, go to a page, do smth and then navigate to same page you were before. But do I have to write again the Given code in js?

Cat
2019-07-15 06:12:30

*Thread Reply:* No, the step definition is defined once in the code. It will execute when it is called, like any other function.

Cat
2019-07-15 06:12:46

*Thread Reply:* Also: Not all of us are fellas.

🎯 Raymond
👏 Aslak Hellesøy
dimliaro
2019-07-15 03:24:21

And tell me how I can "highlight" and send (here in slack) the code or smth else in cute organised boxes 😛

luke
2019-07-15 03:26:52

triple backticks.

😍 dimliaro
luke
2019-07-15 03:26:56
code block
dimliaro
2019-07-15 03:28:58

noice

dimliaro
2019-07-15 03:59:40

Hi, I got this error Error: function timed out, ensure the callback is executed within 60000 milliseconds

I had that issue before and I fixed it with setDefaultTimeout( 60 ** 1000);

Now that I added one extra scenario, it still shows me that message. Any ideas?

Raymond
2019-07-15 09:09:13

*Thread Reply:* Error is pretty self-explanatory. The function is timing out (aka the step is taking too long to complete) either extend the timeout of the individual step or of the overall timeout

dimliaro
2019-07-16 04:55:17

Hi all, does anybody knows if there is a simillar Slack group where I can ask JS questions? Like how I can find and click a button when i have this in inspect element?

&lt;button type="button" class="md-btn md-btn--raised md-btn--text md-btn--raised-pressed md-pointer--hover md-background--primary md-background--primary-hover md-inline-block mp-fidelio-login-button"&gt;&lt;div class="md-ink-container"&gt;&lt;/div&gt;Enter&lt;/button&gt;

I use driver.findElement(By.className('md-btn md-btn--raised md-btn--text md-btn--raised-pressed md-pointer--hover md-background--primary md-background--primary-hover md-inline-block mp-fidelio-login-button')); But I know that it's wrong

Thanks in advance and sorry for the irrelevant post, but i am asking for cucumber purposes

Cat
2019-07-16 05:47:02

*Thread Reply:* ok, so, those aren't strictly JS questions - they are questions specific to the driver you're using. You would need to look for similar groups for that specific type of driver (e.g., wdio, selenium, puppeteer, etc.)

luke
2019-07-16 05:15:34

selenium js or wdio gitter sounds the best options.

Alaeddin
2019-07-18 00:04:37

@Alaeddin has joined the channel

dimliaro
2019-07-18 03:41:50

Hi all The main Idea is: I am on a page and there are two buttons. Each one of them, should navigate me to a different page.

So , I have this code in a feature file:

``` Scenario Outline:I am logged in

Given I am logged in
When I click on &lt;section&gt;
Then I should be in &lt;section&gt; section

Examples: | section | | ATHENA | | FIDELIO |

And this code in stepdefs.js:

``` Given('I am logged in', function(){
      driver.get('<http://localhost:3000/demo_dev/loggedin>');
      takeScreenshot(driver, "Scenario 2: IamLoggedIn.jpg");
});
  When('I click on ATHENA',function(){
    driver.findElement(By.xpath('//**[@id="root"]/div/div[1]/div[4]/div/div[1]/div/a/button')).click();  
    setDefaultTimeout(60 ** 1000);
    takeScreenshot(driver, "Scenario 2: IshouldBeInPageAfterClick.jpg");

  });
  When('I click on FIDELIO',function(){
    driver.findElement(By.xpath('//**[@id="root"]/div/div[1]/div[4]/div/div[2]/div/a/button')).click();  
    setDefaultTimeout(60 ** 1000);
    takeScreenshot(driver, "Scenario 2: IshouldBeInFidelioAfterClick.jpg");

  });
Then ('I should be in FIDELIO section', function(){
  takeScreenshot(driver, "Scenario 2: IshouldBeInFidelio.jpg");

});

Then ('I should be in ATHENA section', function(){
  takeScreenshot(driver, "Scenario 2: IshouldBeInAthena.jpg");

}); 

The result is not what I was hoping. I mean, how can I see if it clicked both of the buttons while testing?The screenshots are the same What am I doing wrong?

Cat
2019-07-18 04:21:34

*Thread Reply:* If your web driver fails to click an element, you should get an error. Also, instead of taking a screenshot alone, you should actually assert something. 🤷‍♀️:skintone2:

dimliaro
2019-07-18 04:58:47

*Thread Reply:* Like?

Cat
2019-07-18 05:30:03

*Thread Reply:* The state of the application? You could assert based on the visibility or existence of an element, etc.

Cat
2019-07-18 05:30:30

*Thread Reply:* It's fine to take a screencap, but that doesn't actually tell your tests if they should pass or fail (although they will if it fails to screencap)

Cat
2019-07-18 05:31:29

*Thread Reply:* for our tooling, we'd do something along the lines of expect(this.driver.isVisible(myElement).to.be.true;

Cat
2019-07-18 05:31:57

*Thread Reply:* for that use case, wdio would get the visibility state of the element being passed in and, if it returned true (visible) the test would pass. If it returned false, the test would fail.

Loki
2019-07-19 10:52:12

@Loki has joined the channel

Loki
2019-07-19 10:52:28

Hello all

Loki
2019-07-19 10:52:50

Cucumber version(0.9.5) does it support parallel execution?

Aslak Hellesøy
2019-07-19 11:12:17

*Thread Reply:* @Loki every release has a changelog where you’ll find the answer: https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md

Loki
2019-07-19 11:17:29

*Thread Reply:* thank you

Loki
2019-07-22 11:05:47

*Thread Reply:* with version 0.9.5 we were able to invoke parallel execution but report generation on execution impacted as it started overwriting with the last instance execution

Murali Nagarajan
2019-07-22 12:21:08

@Murali Nagarajan has joined the channel

Murali Nagarajan
2019-07-22 12:25:15

Hello everyone, do we have any automation around refactoring steps.js when upgrading from Cucumber version(0.9.5) to latest version?

Cat
2019-07-22 12:32:58

*Thread Reply:* To my knowledge, no. That's a pretty huge version gap - I recommend looking through the changelog at breaking changes to see what would need to be altered to get from 0.9.5 to current.

Leo
2019-07-22 15:30:54

Hello everyone, anyone have issues with webdriverIO v5 integrated with cucumberJS for allure?

Gem
2019-07-22 15:46:22

Adding some more context 🙂

Leo (https://cucumberbdd.slack.com/team/UGCFGFHFU)
Leo
2019-07-22 16:30:17

*Thread Reply:* Update: ^ haha thanks, also so maybe I am just not understanding how allure works in general, but when I use the allure command line "allure generate" the report does not generate but when i do "allure serve" it generates the report correctly.

Other than allure for cucumberJS integrated with webdriverIO v5, is there any other reporters currently available?

Leo
2019-07-23 16:15:35

Does anyone here use report portal?

anthrax
2019-07-26 10:47:15

@anthrax has joined the channel

Des Horsley
2019-07-26 16:26:32

@Des Horsley has joined the channel

Amarjeet Singh
2019-07-28 21:57:42

@Amarjeet Singh has joined the channel

znakki
2019-07-30 01:23:17

@znakki has joined the channel

AnjaliGarg
2019-07-30 06:05:39

How to use cucumber with Sencha?

Cat
2019-07-30 06:13:49

*Thread Reply:* Cucumber doesn't care what application framework you're using. It just runs the tests. Whatever you tell it to do in the step definitions is what it will do.

AnjaliGarg
2019-07-31 00:12:44

*Thread Reply:* In case of Dotnet i have used Spec flow and in the step definition file i have used Selenium. If application is of Sencha what can i use in Step definition.

Cat
2019-07-31 05:05:28

*Thread Reply:* You would still use selenium unless you needed to use something else. Whatever you put in the step definitions is entirely dependent upon what and how you're testing - not so much of a cucumber question.

William Mura
2019-07-31 05:58:43

@William Mura has joined the channel

William Mura
2019-07-31 06:00:08

Hi, I have a question about the --require flag. I have a mono repo with some tests at the top level and some tests for each package. I'd like to avoid to duplicate multiple step definitions, but from a package I'm not able to require files from the top level folder. Here is the issue I get TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at assertPath (path.js:39:11) at Object.relative (path.js:1167:5) at getDefinitionLineAndUri (/Users/muraw/Company/l2-sdks/node_modules/cucumber/lib/support_code_library_builder/build_helpers.js:184:27) at buildStepDefinitionConfig (/Users/muraw/Company/l2-sdks/node_modules/cucumber/lib/support_code_library_builder/build_helpers.js:124:7) at SupportCodeLibraryBuilder.defineStep (/Users/muraw/Company/l2-sdks/node_modules/cucumber/lib/support_code_library_builder/index.js:51:79) at Object.&lt;anonymous&gt; (/Users/muraw/Company/l2-sdks/tests/lang/ts/step_definitions/steps.ts:11:1)

Cat
2019-07-31 06:03:03

*Thread Reply:* What command are you sending?

William Mura
2019-07-31 06:24:31

*Thread Reply:* cucumber-js ../../tests/features --require=./tests/step_definitions/**.ts --require=../../../../../tests/lang/ts/step_definitions/**.ts --format progress-bar --require-module=ts-node/register

Cat
2019-07-31 06:32:53

*Thread Reply:* Try ditching the =

Cat
2019-07-31 06:33:19

*Thread Reply:* per docs and my own code, that flag is --require &lt;myPath&gt;

William Mura
2019-07-31 06:41:44

*Thread Reply:* it doesn't change anything

luke
2019-07-31 06:47:05

*Thread Reply:* not sure if it would affect it, but why aren't you in the TLD when running?

Cat
2019-07-31 07:00:07

*Thread Reply:* in that case, I'd confirm the path. Nothing else should be impacting, from what I can tell

William Mura
2019-07-31 07:07:16

*Thread Reply:* but if I move the top level step definitions to my local package it works

William Mura
2019-07-31 07:08:02

*Thread Reply:* @luke I can't actually because I'm using specific dependencies from the package

William Mura
2019-07-31 07:11:12

*Thread Reply:* so I don't want to run them from the TLD

William Mura
2019-07-31 07:24:40

*Thread Reply:* root

  • packages -package1 -tests -src -package.json
    • package2
  • tests -step_definitions
  • package.json

When I run my tests from package1 I cannot use step_definitions from the top level tests

luke
2019-07-31 08:08:35

*Thread Reply:* yes you can, just require something at a higher level than you're at.

William Mura
2019-07-31 08:39:44

*Thread Reply:* ok but I keep getting this error TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

I tried with something very simple:

import { Given } from 'cucumber';

Given('I have a workspace', async function(): Promise&lt;void&gt; {
 ...
})
William Mura
2019-07-31 08:40:49

*Thread Reply:* in the stacktrace I can see that the error point on the Given(...) line, but I think it has nothing to do with my code because it's working correctly if I move that file in my package

William Mura
2019-07-31 13:28:29

*Thread Reply:* I have the same error if I run from the TLD, btw when I use --require-module=ts-node/register does it use the local tsconfig.json file?

William Mura
2019-08-01 11:05:36

*Thread Reply:* Any news?

Gem
2019-08-01 10:32:43

@zsattar1224 I think you may do better asking your question here. 😛

zsattar1224
2019-08-01 10:32:47

@zsattar1224 has joined the channel

Gem
2019-08-01 10:33:13

When you’re asking about “integrating” cucumber-js with mocha, what specifically are you asking about?

zsattar1224
2019-08-01 10:36:52

We already have an existing framework built in mocha and chai. We are looking to automate apis as we lack documentation we are looking towards bdd so we can have documentation and also follow behavior driven format.

Gem
2019-08-01 10:39:47

I’m not super experienced with the js implementation, but what I know of mocha and its setup, I don’t know if there’s really a way to do that. Keeping chai as it’s mean for assertions is totally doable, but I think you’d likely need to break out the code you’re running via mocha’s setups into (preferably) helper methods that you could then have your step definitions call.

Gem
2019-08-01 10:39:55

Paging @Cat for halp

😂 Cat
Gem
2019-08-01 10:40:02

Oh there she is! lol

Cat
2019-08-01 10:40:06

lol was already typing

Cat
2019-08-01 10:40:10

MY PEOPLE NEED ME

😂 Gem
:the_horns: tooky
❤️ mlvandijk
Cat
2019-08-01 10:43:29

So: You can absolutely maintain chai under the hood. I'd like to know more about what you're trying to accomplish, however. While, no, you certainly would not want to wrap your mocha in cucumber-js (yo dawg, I heard you liked testrunners so I put a testrunner on your testrunner...), there are also some architectural and long-term strategy distinctions that fundamentally differentiate each.

👍:skin_tone_3: Gem, Raymond
zsattar1224
2019-08-01 10:51:13

Well our apis lack documnetation and we want our features to be the centralized for how api is suppose to work. So tobaheive this we were thinking of implement bdd using existing mocha chai framework that has existing ui and api tests. Our goal to work under same project so everyone can work in the same framework and transfer of knowledge is also easier.

Gem
2019-08-01 10:52:19

That totally makes sense and it’s a great endeavor to shoot for, it’s just not going to be a drop in solution. 😛

🎯 Cat
Gem
2019-08-01 10:53:06

I’d recommend taking an existing feature and building it in Cucumber without any Mocha so that you can try to get a feel for it.

Gem
2019-08-01 10:53:51

It sounds like you’re getting hung up on what you want to do with your existing stuff before understanding the tools/landscape of things.

Cat
2019-08-01 10:53:59

^^ yes.

Cat
2019-08-01 10:54:30

Mocha is a testrunner. Cucumber is a testrunner. Testrunner turducken is not going to make anyone happy 😉

Gem
2019-08-01 10:58:52

Cucumber is a collaboration tool. 😛

Cat
2019-08-01 11:01:20

*Thread Reply:* lol, you got me

Cat
2019-08-01 11:01:37

*Thread Reply:* But meant more to illustrate that using mocha within cucumber is a bit superfluous

Gem
2019-08-01 11:01:59

*Thread Reply:* 😛 I getcha!

zsattar1224
2019-08-01 11:01:00

Hmm I see

zsattar1224
2019-08-01 11:04:33

So what is the best approach if we want to use existing framework

Cat
2019-08-01 11:06:01

Define "existing framework". If you just want to use mocha cuz you have mocha in place already, just use mocha 🤷 If you want to use the assertions, helper functions, etc that are underneath mocha, that's a different discussion

Cat
2019-08-01 11:07:30

Can you give an example of what you would want to cover in cucumber vs. what you have in mocha?

zsattar1224
2019-08-01 11:11:00

We want to extend the current framework built in mocha chai selenium for ui and request for api to use behavior driven so we can have a centralized features

Cat
2019-08-01 11:12:26

Yes. Got that. Give me an example of what you have now vs. what you you want from cucumber.

zsattar1224
2019-08-01 11:18:56

Well we want to automate api testing for a new product which doesnt have any documentation. And we want to follow behavior driven automation for these apis so we can have a centralized documentation

Cat
2019-08-01 11:19:28

ok. And what does this have to do with your mocha coverage?

Gem
2019-08-01 11:21:13

@zsattar1224 You need to help us help you. 😛 Code examples, even if sanitized, could be a great help.

🎯 Cat
Cat
2019-08-01 11:21:57

If you just want to automate the API, that's pretty straightforward. What's confusing to me is the "integrate cucumber-js with mocha" statement earlier.

Gem
2019-08-01 11:23:49

IMO, it sounds like they want to use feature files to drive their existing mocha setup. (Which definitely ain’t gonna work)

🎯 Cat
zsattar1224
2019-08-01 11:24:13

Yeah that was the thought @Gem

zsattar1224
2019-08-01 11:24:34

Seems like that is not possible

Gem
2019-08-01 11:25:18

Correct. If you’re unable or unwilling to move away from mocha, then you’re stuck. 😞

zsattar1224
2019-08-01 11:26:20

Hmm i see need to have internal discussion. Thanks for the info though. I really appreciate it

Gem
2019-08-01 11:27:00

👍:skintone3: Good luck! We’re here to help if you decide to make the switch. 🙂

Mona Ghassemi
2019-08-02 12:38:59

@Mona Ghassemi has joined the channel

znakki
2019-08-06 04:56:30

Hey, guys! Can we please review this PR with this cool feature for cucumber-js community? https://github.com/cucumber/cucumber-js/pull/1205

individual-it (https://github.com/individual-it)
Assignees
individual-it
Comments
13
👍 Dónal Troddyn, Raymond
luke
2019-08-06 06:23:35

charlie was taking the lead on that and had some strong opinions on that. So I'll leave it to him

luke
2019-08-06 06:24:00

If there are strong OSS js people out there who want to review it feel free.

👍 Raymond
luke
2019-08-06 06:24:17

I'm a rubyist. And I do a bit on the overall stuff, but I'm not too hot on js sadly

Cat
2019-08-06 07:39:28

I can have a look. Hang on

Leo
2019-08-06 18:06:42

In cucumberJS, is there something like a scenario ID or test ID I can store into a variable and then use ? I am using a service built into webdriverIO called visual regression to compare images in my tests, and whenever I take a screen shot and generate a image file, i would like to use that use some sort of unique identifier to name that image with so that I know that this image came from this scenario/test specifically. I am currently using sessionID, but I have multiple scenarios/test per session usually, and therefore session Ids are not unique enough.

Raymond
2019-08-07 14:48:30

*Thread Reply:* I surprisingly can't see access to an id but you can build one based on the scenario such as

Raymond
2019-08-07 14:48:44

*Thread Reply:*

Raymond
2019-08-07 14:49:33

*Thread Reply:* This will output something like spec/cucumber/features/quoting/quotes/modeling/DisplayQuoteCostsData.feature119 which you could then massage into a format you would like for an image name

Raymond
2019-08-07 15:11:12

*Thread Reply:* Also I tested with scenario outlines and the line is unique to each example

Gem
2019-08-06 18:20:36

I'm not sure, but you could create your own guid to use? You could also do some sort of concat of the particular scenario + timestamp or something, too. 🙂

Simon Stratton
2019-08-12 01:56:18

@Simon Stratton has joined the channel

Marco Sanabria
2019-08-13 19:50:10

@Marco Sanabria has joined the channel

Marco Sanabria
2019-08-13 19:50:19

Hello All, I’m using Cucumber JS with Protractor. Is there a cucumberOpts option that I can set in my protractor.conf.js such that cucumber can show the full stack trace when an error happens. Currently the stacktrace it shows references only files in node_modules, nothing directly related to the code I’m writing

Nora
2019-08-13 20:29:34

@Nora has joined the channel

Marco Sanabria
2019-08-14 08:36:18

Hello, anyone who can help me with my question? Thanks in advance. 👇

Marco Sanabria (https://cucumberbdd.slack.com/team/UMBN5EAHW)
Gem
2019-08-14 09:26:46

I never used that combination so unfortunately I can't say. 😞

😞 Marco Sanabria
Marco Sanabria
2019-08-14 09:37:40

*Thread Reply:* I was crossing fingers not to get a response like this 😞

Cat
2019-08-14 09:37:46

I don't use protractor (have in the past, but no longer) but this doesn't strike me as being a cucumberOpts issue

Marco Sanabria
2019-08-14 09:40:15

so you’re saying it might be protractor issue?

Cat
2019-08-14 09:56:26

Most likely

Raymond
2019-08-14 09:59:29

Can you give an example of what stack trace you are receiving and what you are expecting? I do agree with @Cat that I don't believe that to be cucumber related

Marco Sanabria
2019-08-14 10:10:29

*Thread Reply:* So in this screenshot, you can see that the section I marked in the yellow rectangle corresponds to node_modules folder.

The rest of it corresponds to a bot I defined. But the flow that goes through the page objects before getting to the bot is not included in the stacktrace. That’s what I’m missing and that’s what I need

Raymond
2019-08-14 10:19:28

*Thread Reply:* I guess I'm a little confused as to what kind of stack trace you want? This stack trace looks correct to me. From bottom-up has the steps to the root of the failure (selenium failure on a wait)

Marco Sanabria
2019-08-14 10:52:48

*Thread Reply:* So let’s say I have a login test case. The architecture I have is:

  • Gherkin
  • Step definition
  • Login Page Obejct
  • Bot Style (to interact with the browser)
Marco Sanabria
2019-08-14 10:55:12

*Thread Reply:* So the stacktrace I’m expecting is for instance, something that includes what’s in the screenshot above, but then the stack continues telling that from step definition on line 3, it went to page object on line 36 and then it went to bot on line 17 and that’s where it crashed

Marco Sanabria
2019-08-14 10:55:17

*Thread Reply:* does it make sense?

Cat
2019-08-14 10:56:16

*Thread Reply:* Depends on how your code is referencing the other pieces of the architecture.

Cat
2019-08-14 10:56:32

*Thread Reply:* but nothing in cucumber config is going to alter that

Marco Sanabria
2019-08-14 11:02:38

*Thread Reply:* mmm… I see, thank you!

Marco Sanabria
2019-08-14 10:05:09

sure

Cat
2019-08-14 10:06:14

Let's switch to a thread so that it's not alerting for the entire channel 🙂

👍 Raymond
Alaeddin
2019-08-16 04:54:33

How can I generate report when running cucumber features?

Jonas Amundsen
2019-08-16 05:35:01

@Jonas Amundsen has joined the channel

Jonas Amundsen
2019-08-16 05:35:16

I was missing ability to use Rule in my features files

Jonas Amundsen
2019-08-16 05:36:05

Started digging a bit into Gherkin history and noticed child_process and spawn. Do I have to worry that cucumber will spawn child processes when using it?

Aslak Hellesøy
2019-08-16 05:36:23

Hi @Jonas Amundsen - cucumber-js is still on Gherkin 5 - the Rule keyword was implemented in Gherkin 6

Aslak Hellesøy
2019-08-16 05:37:09

Gherkin 6 (and 7) spawn an executable to do the parsing (it’s written in Go).

Aslak Hellesøy
2019-08-16 05:37:52

We may change this back to a native JavaScript implementation since the spawn executable approach may cause some issues (primarily with virus scanners)

Jonas Amundsen
2019-08-16 05:38:36

Personally I enjoy and appreciate the ability to inspect node_modules myself and see what I am about to execute

Jonas Amundsen
2019-08-16 05:38:53

(Which is why I EG. dislike minified builds for modules not intended for the web)

Jonas Amundsen
2019-08-16 05:39:07

I lose that ability, it seems like

Aslak Hellesøy
2019-08-16 05:40:03

I can understand that. Cucumber has a small team of contributors, and maintaining feature parity in Java/JavaScript/Ruby/Python/.NET/Go/etc is quite a big undertaking.

Aslak Hellesøy
2019-08-16 05:40:22

That’s why we’re experimenting with a shared runtime

Jonas Amundsen
2019-08-16 05:40:27

I see

Jonas Amundsen
2019-08-16 05:42:08

Cudos to you guys and gals for all the work. Your response time is always impeccable!

slackbot
2019-08-16 05:42:09

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Aslak Hellesøy
2019-08-16 05:43:18

Thanks @Jonas Amundsen! We’re still undecided between a) maintaining 6+ biggish implementations and b) moving most code to a shared runtime.

Aslak Hellesøy
2019-08-16 05:43:37

There are pros and cons with both approaches.

Aslak Hellesøy
2019-08-16 05:45:35

In the short term we’ll probably ditch using a shared go executable runtime for the core of Cucumber. We’ll experiment with some optional report formatters written in go to test our community’s appetite for installing and running code that spawns an executable.

Aslak Hellesøy
2019-08-16 05:46:16

What are your concerns about spawning executables? Spyware? Not knowing what it does?

Jonas Amundsen
2019-08-16 05:47:32

Orphaned processes in CI machines that aren't very monitored comes to mind

Jonas Amundsen
2019-08-16 05:48:10

You need to perform signal handling and even then there's edge cases

Jonas Amundsen
2019-08-16 05:48:32

Or I, as I user, have to do it

Jonas Amundsen
2019-08-16 05:50:15

I guess there's going to be a pipe between the parent and the child, so the child needs to act appropriately when this closes

Aslak Hellesøy
2019-08-16 05:50:24

@Jonas Amundsen - I recently fixed a bug in cucumber-electron for killing sub processes: https://github.com/cucumber/cucumber-electron/pull/31/files#diff-068885e60aad1169ee544e485715e201R97

Aslak Hellesøy
2019-08-16 05:50:48

But if the parent process is killed, that code might not run

Aslak Hellesøy
2019-08-16 05:52:36

Yes, the child and parent will talk over a STDOUT/STDIN pipe

Jonas Amundsen
2019-08-16 05:53:08

That stuff can be tricky to get right. Then there's the non-posix compliant systems making it even more difficult

Aslak Hellesøy
2019-08-16 05:54:21

Yeah. We’re also considering using a server/daemon for the shared runtime. Language-specific front-ends would talk to it over TCP

Jonas Amundsen
2019-08-16 05:54:42

That's quite some change in terms of complexity

Aslak Hellesøy
2019-08-16 05:55:01

The prototype is here: https://github.com/cucumber/cucumber-engine

Stars
<p>3</p>
Language
<p>Go</p>
Aslak Hellesøy
2019-08-16 05:56:14

The shared runtime (cucumber-engine) does all the gherkin parsing, matching of step definitions and reporting. The language-specific part would be just a thin layer that executes step definitions and talks protobufs with the runtime.

Aslak Hellesøy
2019-08-16 05:57:28

It does increase the internal complexity for sure, but it also means less code to maintain, easier to write a cucumber for a new language, and a consistent behaviour across all platforms.

Aslak Hellesøy
2019-08-16 05:58:02

The tricky bit is to avoid a worse user experience for users.

Jonas Amundsen
2019-08-16 05:58:34

Have considered parser generators as an alternative to writing N parsers yourselves?

Aslak Hellesøy
2019-08-16 05:59:04

We wrote our own parser generator 🙂 gherkin uses that.

Jonas Amundsen
2019-08-16 05:59:16

Aha, I see

Aslak Hellesøy
2019-08-16 05:59:33

It helped us support multiple languages, but there is still a fair bit of logic to implement by hand in the parser.

Aslak Hellesøy
2019-08-16 06:01:18

Another semi-complex library is the cucumber-expressions engine. We’re maintaining that in Ruby/JavaScript/Go/Java at the moment, and that’s a lot of work. SpecFlow (.NET) doesn’t even have cucumber-expressions, because nobody has bothered porting it to .NET. But if everything just sat in a shared runtime….

Aslak Hellesøy
2019-08-16 06:02:47

So @Jonas Amundsen - if the shared runtime was a daemon process that is started before running Cucumber, and protobuf comms happened over TCP, any thoughts on potential problems with that approach?

Jonas Amundsen
2019-08-16 06:03:51

When you say daemon, will it be designed to remain running afterwards?

Jonas Amundsen
2019-08-16 06:04:12

I suppose it can't itself know when to quit

Aslak Hellesøy
2019-08-16 06:04:31

It could be designed to kill itself after N seconds (for CI), or it could stay up indefinitely (for dev machines)

Jonas Amundsen
2019-08-16 06:04:54

I'm happy as long as CI is considered

Aslak Hellesøy
2019-08-16 06:05:17

And obviously it could be sent a protobuf message (or SIGKILL) telling it to quit

Aslak Hellesøy
2019-08-16 06:06:51

Good! Our main worry is that people will get upset by having to install a “program” in addition to their npm/gem/jar/whatever. We’ll run an experiment with formatters first to see how well it goes down

Aslak Hellesøy
2019-08-16 06:07:51

Right now Gherkin 6 bundles cross-compiled executables inside the package, but that seems to get stopped by corporate firewalls/virus scanners, so we’ll probably abandon that approach.

Aslak Hellesøy
2019-08-16 06:08:29

(Gherkin 7 as of this week)

Jonas Amundsen
2019-08-16 06:09:06

I experimented a while ago with an ~/.npmrc that set ignore-scripts=true, which obviously disabled any installers, but also removed what I basically consider to be a remote code execution vulnerability

Jonas Amundsen
2019-08-16 06:09:20

However, this caused so many issues that I eventually caved in

Jonas Amundsen
2019-08-16 06:10:04

I'm not a huge fan, hehe

Aslak Hellesøy
2019-08-16 06:10:27

Maybe we just need to wait until all software in the world is written in one ubiquitous programming language so we don’t need to worry about things like this!

Aslak Hellesøy
2019-08-16 06:10:32

JavaScript of course

Jonas Amundsen
2019-08-16 06:10:51

Haha, yeah

Jonas Amundsen
2019-08-16 06:10:53

Of course

Jonas Amundsen
2019-08-16 06:11:11

Btw, do you have any insights into whether cucumber-js will be updated to recent gherkin?

Aslak Hellesøy
2019-08-16 06:12:46

I think we need to resurrect the native JavaScript implementation of Gherkin and then add Rule support to it. I deleted it a few months ago and now the gherkin npm package is just a few lines of js delegating to the go executable.

Aslak Hellesøy
2019-08-16 06:13:07

It’s too risky to make a release that relies on those embedded executables.

Aslak Hellesøy
2019-08-16 06:14:28

We’ll call that Gherkin 8. Then we can add that to cucumber-js.

Jonas Amundsen
2019-08-16 06:20:51

That sounds like a plan 🙂 Tell me if you need someone to test anything and such

Aslak Hellesøy
2019-08-16 06:21:18

Will do! Thanks for your insight too.

Simon Stratton
2019-08-19 07:15:21

One of my clients has an Angular (TypeScript) app that is already live, but under continuous development. Karma is used for Unit Testing currently and Protractor for everything else - which means their regression suite is growing out of hand. I’d like to shift the tests further left and do some fast acceptance tests in Karma - and try to reduce the I/O like the excellent subsecondtdd. Can anyone help with tips or advice for creating fast acceptance tests in Karma with Cucumber?

Martin Fabián
2019-08-20 00:42:17

Can you run one feature file from before hook tag?

Jonas Amundsen
2019-08-21 00:29:31

Aslak, I'm itching for rules in my cukes - is there anything I can do to help? I can probably do the grunt work in terms of resurrecting the old version from history, and if the berp has already been updated, even write some tests for the new behavior.

Aslak Hellesøy
2019-08-21 05:03:04

Hi @Jonas Amundsen yes you can help! In Gherkin v6 we ripped out most of the Java code and delegated to embedded gherkin executables in Go. We’re abandoning this approach (too risky), and we need to resurrect the native Gherkin JavaScript implementation:

Aslak Hellesøy
2019-08-21 05:06:19

1) Create a new branch from master 2) Add the JavaScript parser code that was deleted prior to v6 3) Port the code to TypeScript (all the JavaScript code was ported to TypeScript recently) 4) Implement support for the Rule keyword 5) Keep the ability to delegate to a Go executable (should be a boolean switch) so we keep the door open in the future. 6) Release Gherkin 8 7) Upgrade Cucumber.js to use Gherkin 8

Jonas Amundsen
2019-08-21 05:07:09

Is the desired AST with rules defined already?

Aslak Hellesøy
2019-08-21 05:08:53

Yes, master supports rules, but the only parser implementation on master is Go at the moment. Java/JavaScript/Ruby currently spawns the go executable to do the actual parsing. We need to go back to how it was done in v5 - a pure JavaScript implementation.

Aslak Hellesøy
2019-08-21 05:08:56

I’d be happy to help you if you have any questions. And we’ll pay you if you submit expenses to https://opencollective.com/cucumber

opencollective.com
Jonas Amundsen
2019-08-21 05:17:31

Cool, thanks for the write-up. I'll give you a ping when I've made some tangible progress

:dancing_pickle: matt-SmartBear
Aslak Hellesøy
2019-08-21 05:34:06

*Thread Reply:* @Jonas Amundsen for step 2) I recommend you grab the code in gherkin/javascript/lib at tag gherkin-v5.1.0

matt-SmartBear
2019-08-26 14:57:58

*Thread Reply:* Don’t forget to ping if you get stuck too! We’re here to help if we can 🙂

Jonas Amundsen
2019-08-28 01:55:37

*Thread Reply:* Matt, I've posted a PR with some preliminary work if you would like to take a look: https://github.com/cucumber/cucumber/pull/689

badeball (https://github.com/badeball)
Labels
language: javascript, library: gherkin
Aslak Hellesøy
2019-08-28 03:42:02

*Thread Reply:* Hey @Jonas Amundsen that looks impressive! I will try to review this in the next couple of days. Thanks so much!

Nick Gonzalez
2019-08-21 12:11:02

Cucumber: v5.1.0 Question: How do you attach a screenshot to the results? Error: world.attach() is not a function

Cat
2019-08-21 12:12:43

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/world.md

Cat
2019-08-21 12:13:23

*Thread Reply:* and more details on attachments: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md

Marco Sanabria
2019-08-23 19:50:08

Hi All, I have a hook like this Before({ tags: '@deleteInvestigation' }, async () =&gt; await createInvestigations(1, Constants.investigationToDelete));

For some reason, that hook runs not only for the scenarios tagged as @deleteInvestigation but for any other scenario as well

Cat
2019-08-24 09:01:33

*Thread Reply:* You're using an arrow function. It impacts this which is necessary for hooks, steps, and the world instance to operate properly. Change it to async function () {...} and it should work

Marco Sanabria
2019-08-24 09:04:48

*Thread Reply:* Thank you! I'm gonna try that

Cat
2019-08-24 09:05:18

*Thread Reply:* should get it working, but if it doesn't, lmk and we can dig more 🙂

Marco Sanabria
2019-08-24 09:06:28

*Thread Reply:* I appreciate it

Marco Sanabria
2019-08-24 12:30:50

*Thread Reply:* @Cat interesting. It did work. Why is it that when using arrow functions it doesn’t work as expected?

slackbot
2019-08-24 12:30:50

*Thread Reply:* Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

Cat
2019-08-26 06:26:54

*Thread Reply:* It has to do with the way arrow functions bind lexical this, which impacts this which is shared between the world, steps, and hooks (as mentioned above).

👍 Marco Sanabria
Marco Sanabria
2019-08-23 19:50:10

any idea?

Marco Sanabria
2019-08-24 18:34:39

Hi All, is there a way to run a hook after all .feature files have run?

Cat
2019-08-26 06:27:10

*Thread Reply:* AfterAll ()

Marco Sanabria
2019-08-26 07:57:25

*Thread Reply:* I know of AfterAll(), but I’m using protractor which uses webdriver js. And because of the way webdriver js handles things, AfterAll() is triggered after every single .feature file, rather than running after all files have run

Cat
2019-08-27 06:47:20

*Thread Reply:* Then I would check with protractor folks 🤷 It's going to be distinct from using cucumber itself. It's not actually a webdriver js issue, iirc, but rather that it's a cucumber plugin for protractor, rather than cucumber running protractor 🙂

👍 Marco Sanabria
Marco Sanabria
2019-08-27 07:14:24

*Thread Reply:* Thank you!

Cat
2019-08-27 07:14:52

*Thread Reply:* np 🙂

luke
2019-08-26 00:46:52

so I'm not sure but are you looking for a teardown hook? In ruby there exists one called at_exit there could be one for JS I'm not sure.

Alaeddin
2019-08-27 23:01:33

how to run cucumber js in intellij with environment variable?

Aslak Hellesøy
2019-08-28 00:54:59

@Alaeddin select the test run from the dropdown in your icon menu bar and select “Edit Configurations…”

👍 Alaeddin
Amanda R
2019-08-30 07:49:38

@Amanda R has joined the channel

Marco Sanabria
2019-09-02 11:08:25

Hey All, so I have a scenario like this: I need to run the same test case for three different users and for each user I need to cover 5 sections

user 1
         section 1
         section 2
         section 3
         section 4
         section 5
user 2
         section 1
         section 2
         section 3
         section 4
         section 5
user 3
         section 1
         section 2
         section 3
         section 4
         section 5
Marco Sanabria
2019-09-02 11:08:49

is it possible to accomplish this with a Scenario Outline?

Marco Sanabria
2019-09-02 11:09:04

if so, how do I specify the Examples table?

Gem
2019-09-02 21:10:22

Put your users in your example table, assuming that your "section 1-5" lines are a single scenario?

Marco Sanabria
2019-09-02 21:39:39

nope, every section corresponds to a single scenario

luke
2019-09-02 23:10:51

I would do this in a rake/job/make/insert other scheduling idea here

luke
2019-09-02 23:11:22

so have some logic that sets user = user1 - then run the five tests.

Then have the job cycle through three users running all tests.

luke
2019-09-02 23:12:27

in ruby some simple pseudo logic would be

[user1, user2, user3].each do |user|
  ENV['THING'] = user
  Rake::Task['test_to_run'].invoke
end
Ayethin
2019-09-03 01:57:49

^ I would handle this outside of the features themselves and pass it as an environment var, as luke has done here. Unless there is specific scenarios for each user, then those would ideally be done as different features.

Cat
2019-09-03 05:03:07

Imo, it depends on the context. A scenario outline could easily be applied, from the looks of it, but whether or not it's appropriate depends on the relevance of the user params

👍 Ayethin, Marco Sanabria
Marco Sanabria
2019-09-03 07:44:59

Thank you All

tooky
2019-09-03 08:40:22

Hey @Marco Sanabria - I was just reading this back and I wondered if the scenarios you were running for different users were exactly the same? Are any of the behaviours / outcomes different depending on the user?

Marco Sanabria
2019-09-03 08:47:00

so, the scenario is something like this: Say I have a web page that has 5 sections, the user is able to add a comment on each section (the 5 sections I listed above). Ok, now we have three different user roles and we wanna make sure that all of the users can post comments on all of the sections

Marco Sanabria
2019-09-03 08:47:24

so, for each role, I need to run 5 scenarios (one per section)

Marco Sanabria
2019-09-03 08:47:31

does that make sense?

Marco Sanabria
2019-09-03 08:50:09

currently I have a scenario outlinefor the 5 sections

Marco Sanabria
2019-09-03 08:50:30

I was wondering id there was something like nested examples tables

Marco Sanabria
2019-09-03 08:50:48

where I can nest the sections table in the users table

tooky
2019-09-03 08:51:54

I think that would quickly become unreadable.

👆 Cat
tooky
2019-09-03 08:52:37

I’m interested in this idea of testing the same behaviour multiple times, and whether there’s a better way to get the confidence that your application works as expected.

🎯 Cat
Marco Sanabria
2019-09-03 08:52:56

yeah

tooky
2019-09-03 08:54:54

Can I check that I’ve understood:

  • there’s a commenting capability
  • currently, it can be used in 5 places in the application
  • currently there are 3 different user roles that can use that capability
tooky
2019-09-03 08:56:01

So, by testing that capability in all 5 sections for each of the 3 user types we end up with 15 tests of essentially the same thing.

Marco Sanabria
2019-09-03 08:56:53

correct

tooky
2019-09-03 08:57:27

What would happen if you added another user role?

Marco Sanabria
2019-09-03 08:58:33

if we follow the same line, that would mean we would end up with 20 tests 🤔

Marco Sanabria
2019-09-03 08:59:05

(assuming that the new role has the right to make comments as well)

tooky
2019-09-03 08:59:11

Hah - right!

tooky
2019-09-03 08:59:50

Ok, so bear with me a little bit 🙂

tooky
2019-09-03 09:00:35

Let’s assume that adding more and more tests of the same commenting function is something we’d like to avoid.

tooky
2019-09-03 09:01:23

However, we’re trying to learn something by having those tests, what are we trying to learn?

Marco Sanabria
2019-09-03 09:04:15

I don’t know, learning why we wanna avoid that?

tooky
2019-09-03 09:06:09

I mean - we’ve got 15 tests to give us confidence that the app is working correctly:

  • the commenting system works
  • we can make comments in each of the 5 sections
  • each of the user roles is able to make comments
Cat
2019-09-03 09:06:43

Let's consider another question: Is it likely that commenting will break for one type of user on one section vs. all sections?

💪 tooky, mlvandijk
Cat
2019-09-03 09:07:13

Are there sections users can't comment on? (or some users can't?)

Marco Sanabria
2019-09-03 09:07:45

gotcha

tooky
2019-09-03 09:10:13

Right! Adding more special cases will just result in needing more tests and if we bundle up each of those different concerns we get a combinatorial explosion of the number of tests we need.

Cat
2019-09-03 09:11:30

^^ and when we do so, we are increasing the time it takes to run our tests AND decreasing their value

💯 tooky, mlvandijk
Marco Sanabria
2019-09-03 09:11:53

yeah, I see the point

👍 Cat, tooky
tooky
2019-09-03 09:14:35

I think what I’d want to do is find those different concerns that we care about and test them individually, probably at a lower level. Then maybe I’d just need one or two integrated tests that give me confidence the whole thing hangs together.

🎯 Cat, mlvandijk
Marco Sanabria
2019-09-03 09:15:28

thank you Folks! 👍

👍 Cat, tooky
slackbot
2019-09-03 09:15:29

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

Des Horsley
2019-09-05 17:32:21

Hopeing to get some help with cucumber and typescript. I've used a data table in a step, when I output this table to the console, the object is a DataTable that looks like:

DataTable {
    rawTable: [['xxx'], ['xxx']]
}

I was hoping to strongly type this in my cucumber step, but can't find a matching type in the @types/cucumber library. I was hoping to do something like this:

Then(/^Carl should see$/, async (thingToSee: DataTable) =&gt; {
eduardo alarcon
2019-09-10 11:38:23

@eduardo alarcon has joined the channel

eduardo alarcon
2019-09-10 11:45:44

hi everyone, i have a question about integration of cucumber with YAML datatest, anyone know it’s posibble ? or with JSon. i need get the test data from a file (YML or JSON), i hace that code but that don’t work Y_Y. can help me 😄

Cat
2019-09-10 11:54:37

*Thread Reply:* You can use YAML or JSON w/JS - cucumber is for demonstrating behaviors, however. You wouldn't reference the fields the way you're doing here. What precisely are you attempting to do with the data here?

eduardo alarcon
2019-09-11 06:41:07

*Thread Reply:* The idea is that product owners can see what is being involved in the tests, as they do not know the code, it would cost them a little more to understand.

Cat
2019-09-11 06:44:46

*Thread Reply:* Why would you not simply use business language for the data tables? e.g., I insert &lt;name&gt; in the name field where the data value for name is, say Steve (or whatever value, really) This would then pass into the stepDef function, which you then would tie to datosPrueba.comment

:dancing_pickle: eduardo alarcon
Lucas S.
2019-09-11 02:11:39

@Lucas S. has joined the channel

saikumar
2019-09-13 02:29:22

@saikumar has joined the channel

Razvan Trufin
2019-09-16 06:36:02

@Razvan Trufin has joined the channel

Ryan Kazokas
2019-09-16 12:43:19

Hi, does anyone have here any experience or can recommend documentation around mocking out API calls. We use a couple of different API's in our angular webapp and it's been a pain handling this since from what I can tell, using protractor-cucumber js, it doesn't allow to inject the mocks so we have to use the actual objects. Currently we are using HMR to achieve a mock client but so far has proven to be very messy. I know that protractor is made for e2e testing, so ideally the test would hit the API, but we want a controlled environment to be able to run our cukes. Our plan of attack is to add a mock server that we can pass our given's to so that the server can respond accordingly but wasn't sure if there was a better way to handle that.

Des Horsley
2019-09-17 17:48:58

*Thread Reply:* Hi @Ryan Kazokas we use Angulars own In memory api tool, its very extensible and has covered all our requirements so far.

I've hooked in an environment variable so that we can flick from using the mocked api to the real ones while developing.

John Papa uses it in the tour of heros demo, I've taken that and build cucumber into it in this repo as a proof of concept: https://github.com/DesHorsley/angular-tour-of-heroes

Language
<p>TypeScript</p>
Last updated
<p>7 months ago</p>
Ryan Kazokas
2019-09-18 04:15:59

*Thread Reply:* Awesome, thanks for the advice! I will definitely take a look at this!

Ryan Kazokas
2019-09-19 10:36:38

*Thread Reply:* @Des Horsley Almost thought we'd be able to use this, but we can't since we have an SDK that is using axios and is not using httpclient to make the requests. From what i can tell it will only work with the http and httpclient

Des Horsley
2019-09-19 17:03:31

*Thread Reply:* That's a shame

Ryan Kazokas
2019-09-20 04:53:24

*Thread Reply:* Thanks for the help!

Michael Bates
2019-09-16 12:44:11

@Michael Bates has joined the channel

R.J. Davis
2019-09-16 12:45:00

@R.J. Davis has joined the channel

luke
2019-09-17 00:17:45

is there not a fixtures and fittings npm package you can use? I know there are plenty in java and ruby

Ryan Kazokas
2019-09-17 03:26:04

*Thread Reply:* I was unable to find anything that would aid in this outside of running an actual mock server, b ut this has it's limitations, mainly running tests in parallel is the main concern with that

Ryan Kazokas
2019-09-17 03:30:12

*Thread Reply:* Agreed. I know java has good support as I use cucumber there, but i think the main problem is that unlike junit, protractor isn't really made for mocking/stubbing but more for browser automation.

blankpicture
2019-09-22 02:18:37

@blankpicture has joined the channel

blankpicture
2019-09-22 02:43:35

Heyo! I have a few questions and would appreciate if someone could shine some light on them. I am on v5.1.0 and using TS in my project. 1) As per doc on git: Use --tags &lt;EXPRESSION&gt; to run specific features or scenarios Passing a single tag @smoke works just fine, but if you are passing multiple tags as per <EXPRESSION> format using and, or it throws Error: ENOENT: no such file or directory, open:'...' Example call: cucumber-js --tags @smoke or @test

I am wondering if I am doing something wrong or is this an issue?

2) Is there a way to pass custom CLI options to the child processes spawned with --parallel? I am able to manually parse additional options which I provide after: cucumber-js --tags @smoke -- --customFlag and it works for non parallel runs. Or perhaps - is there a better way to do this, extend cucumberjs CLI somehow? 3) Perhaps I am not the brightest crayon in the pack - but how exactly can you listen to events emitted?(scenario, step, test run ended or whatever events there are) I didn't see anything in the docs that would help. Browsing on the web - there seem to be various mentions of it, but it is mostly for older Cuke versions.

luke
2019-09-23 00:12:01

1) you can wrap the tags in quotation marks, that will help your cli

blankpicture
2019-09-24 01:13:35

*Thread Reply:* Thank you, I will give it a go!

David Vandenbroeck
2019-09-24 09:30:44

@David Vandenbroeck has joined the channel

Dennis
2019-09-24 12:35:22

@Dennis has joined the channel

Dennis
2019-09-24 14:19:26

Good afternoon. I am trying to run Chrome in headless mode. My world.js looks like this:

Gem
2019-09-24 14:24:17

Then run chrome in headless mode. 😄

Gem
2019-09-24 14:24:27

https://developers.google.com/web/updates/2017/04/headless-chrome

Google Developers
👍 Dennis
Dennis
2019-09-24 14:25:03

This is my world.js In package.json I have "chromedriver" "76.0.0" I've downloaded the appropriate chomedriver version for windows. I've checked my path in environment variables. But the session still does not run headless. Any suggestions? And thanks @Gem, I will read the link you provided.

Dennis
2019-09-25 09:09:28

*Thread Reply:* Was able to get this working again this morning by following https://intoli.com/blog/running-selenium-with-headless-chrome/ which was referenced in the link @Gem provided. I inherited this project, so I deleted all the previous chrome setup and replaced with this much simpler version

👍:skin_tone_3: Gem
Gem
2019-09-25 10:01:15

*Thread Reply:* Congrats! 🙂

🙏 Dennis
😁 Dennis
Jonas Amundsen
2019-09-25 01:29:00

So, I'm trying to match When I press "foo" -&gt; "bar" -&gt; "baz", but the following expression /^I press "([^"]+)"(?: -&gt; "([^"]+)")**/ doesn't work because all but the last captured optional group is retained, as shown below

$ node
&gt; 'I press "foo" -&gt; "bar" -&gt; "baz" -&gt; "qux"'.match(/^I press "([^"]+)"(?: -&gt; "([^"]+)")**/)
[ 'I press "foo" -&gt; "bar" -&gt; "baz" -&gt; "qux"',
  'foo',
  'qux',
  index: 0,
  input: 'I press "foo" -&gt; "bar" -&gt; "baz" -&gt; "qux"',
  groups: undefined ]
slackbot
2019-09-25 01:29:01

Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

Jonas Amundsen
2019-09-25 01:29:40

Is this just the way it is and should I then parse the series with code?

Jonas Amundsen
2019-09-25 01:38:49

And with doesn't work I mean that buttonTexts in When(expression, (...buttonTexts) =&gt; ...); aren't populated with all matching button texts

slackbot
2019-09-25 01:38:50

Hi, it's cukebot again. "Doesn't work" is rather vague. What are you seeing and what had you expected to see?

Aslak Hellesøy
2019-09-25 04:59:01

*Thread Reply:* Shut up cukebot!

😁 Des Horsley
Aslak Hellesøy
2019-09-25 05:02:51

@Jonas Amundsen do you have a variable number of -&gt; in your steps?

Jonas Amundsen
2019-09-25 05:23:14

That is indeed the idea! Per now I've solved it by matching all the quoted names separated by -&gt; and parsing them with code

Jonas Amundsen
2019-09-25 05:23:42

I realize now that this might be a restriction of Regexp.match more than it is of Cucumber

Aslak Hellesøy
2019-09-25 05:32:55

@Jonas Amundsen have you considered defining a custom parameter type? https://cucumber.io/docs/cucumber/cucumber-expressions/#custom-parameter-types

Jonas Amundsen
2019-09-25 05:34:24

Ahh, that sounds a lot like something I want. I never thought about that, thanks! 😄

azam
2019-09-30 00:14:04

@azam has joined the channel

VictorSalgado
2019-10-02 21:38:21

@VictorSalgado has joined the channel

VictorSalgado
2019-10-02 22:48:53

Hi folks! I have made this question in general help channel and I don't get answer, so may be here I can get any idea to solve my use case. I'm working with protractor with cucumber, so I want to fill the data table content with values that are contained in a JSON file, the reason to do that is because depending of a protactor comand argument these values have to change (f.e. protractor sanity.config.js --param.a have to make login test with user: demo1 password: 1234 and protractor sanitiy.config.js --param.b have to make login test with user: demo2 password: 5678, for a few use case I know I can duplicate the feature but in case the data comes bigger I think the most usefull is read data table content from json values depending on the parameter, is this possible? Any workaround to solve this use case? Basically I want to use different data table examples depending a on input parameter

chrismarks
2019-10-04 00:40:08

off the top of my head, you'd need to write something to parse the json, then potentially create an outline from the values?

Amanda R
2019-10-04 13:40:12

is there a good recommended tutorial to follow with a live project?

mlvandijk
2019-10-05 23:41:08

@Amanda R We have https://cucumber.io/docs/guides/10-minute-tutorial/ which tells you how to get started with a project, or https://cucumber.io/docs/installation/javascript/ which tells you how to install it. Do either of those help you?

Amanda R
2019-10-07 07:33:27

*Thread Reply:* @mlvandijk thanks I've seen those but I was looking more for a tutorial to code along with to learn.

mlvandijk
2019-10-07 07:37:29

*Thread Reply:* What do you want to learn? There's also Cucumber School if you want a course on BDD / Cucumber.

Amanda R
2019-10-07 07:40:42

*Thread Reply:* I was trying to find tutorials with BDD and JS, that site only has Java or Ruby

znakki
2019-10-07 06:43:29

Hey, folks Just noticed that the new version of cucumber doesn't work with cucumber-pretty module. need to update the cucumber-pretty module based on the latest event protocol methods. https://github.com/kozhevnikov/cucumber-pretty/issues/10

Znakki (https://github.com/Znakki)
Doug
2019-10-09 09:01:54

@Doug has joined the channel

Jonas Amundsen
2019-10-10 05:47:12

Are doc strings compatible with templates? IE. can I write scenario outlines like following

Scenario Outline: foo
  Then foo
    """
    &lt;bar&gt;
    """

  Examples:
    | bar |
    | 1   |
    | 2   |
    | 3   |
Aslak Hellesøy
2019-10-10 07:42:06

*Thread Reply:* @Jonas Amundsen yes you should be able to. If not it’s a bug 🙂

luke
2019-10-10 06:24:18

Another good question. People are on fire today.

🔥 mlvandijk
luke
2019-10-10 06:24:29

My gut would say yes but they may need escaping.

luke
2019-10-10 06:24:36

but that's not based on fact, just a gut feel.

luke
2019-10-10 06:24:45

because other special characters exist, but they need escaping.

luke
2019-10-10 06:25:08

I'll have a quick check on cucumber rails because we have a bunch of docstring tests.

luke
2019-10-10 06:26:56

Ok it works for me without escaping. so go ahead.

luke
2019-10-10 06:27:17

I amended one test from cucumber-rails like the following (Apologies it's long winded)

luke
2019-10-10 06:27:20
Feature: No Database

  Allow Cucumber to work with a Rails app without a database

  Scenario Outline: No ActiveRecord and DatabaseCleaner
    Given I have created a new Rails app with no database and installed cucumber-rails
    # Turn off ActiveRecord
    When I write to "config/application.rb" with:
      """
      require File.expand_path('../boot', __FILE__)

      require 'action_controller/railtie'
      require 'action_mailer/railtie'
      require 'rails/test_unit/railtie'

      Bundler.require(:default, Rails.env) if defined?(Bundler)

      module TestApp
        class Application &lt; Rails::Application
          config.encoding = 'utf-8'
          config.filter_parameters += [:password]
        end
      end
      """
    And I overwrite "features/support/env.rb" with:
      """
      require 'cucumber/rails'
      """
    And I remove the 'database_cleaner' gem from the Gemfile
    And I remove the 'sqlite' gem from the Gemfile
    And I write to "app/controllers/posts_controller.rb" with:
      """
      class PostsController &lt; ApplicationController
        def index
          raise 'There is an error in index'
        end
      end
      """
    And I write to "config/routes.rb" with:
      """
      TestApp::Application.routes.draw do
        resources :posts
      end
      """
    And I write to "features/posts.feature" with:
      """
      Feature: posts
        Scenario: See them
          When I view the &lt;test_one&gt;
      """
    And I write to "features/step_definitions/posts_steps.rb" with:
      """
      When('I view the posts') do
        visit '/posts'
      end
      """
    And I run `bundle exec rake cucumber`
    Then it should fail with:
      """
      There is an error in index
      """

    Examples:
      | test_one |
      | posts    |
luke
2019-10-10 06:27:34

Important bit is

    And I write to "features/posts.feature" with:
      """
      Feature: posts
        Scenario: See them
          When I view the &lt;test_one&gt;
      """
Jonas Amundsen
2019-10-10 06:45:15

Cool! The reason I'm wondering is because I was surprised to see it wasn't working with cypress-cucumber-preprocessor. This is a somewhat interesting tool, because it integrates Cucumber with Cypress, where the latter provides its own test constructs (describe, it, etc.). Hence, the tool must traverse the AST by itself and re-implement some of this logic.

Aslak Hellesøy
2019-10-10 07:47:05

@Jonas Amundsen it uses gherkin 5 (https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/bfdb5af466a2853937ecd2b209eb6129a79caeb9/package.json#L54), which might have a bug with this. I can’t find any mention of fixing this bug in the changelog (https://github.com/cucumber/cucumber/blob/master/gherkin/CHANGELOG.md) - if it was ever reported. Maybe the bug is still there, IDK.

Jonas Amundsen
2019-10-10 07:49:13

Does gherkin handle replacement though? The tool (cypress-cucumber-preprocessor) performs replacement by itself, as seen here [1] and here [2]

[1] https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/v1.16.2/lib/createTestFromScenario.js#L10-L14 [2] https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/v1.16.2/lib/createTestFromScenario.js#L109-L117

Jonas Amundsen
2019-10-10 07:50:56

Ah, so the outputted pickles doesn't contain outlines, but expanded scenarioes where this is replaced?

Aslak Hellesøy
2019-10-10 07:51:35

PR: https://github.com/cucumber/cucumber/pull/292 - released in 5.1.0, which is what cypress-cucumber-preprocessor is using.

rjwittams (https://github.com/rjwittams)
Labels
Slow Burner, library: gherkin
Comments
15
Aslak Hellesøy
2019-10-10 07:52:09

So if it’s not working they have implemented their own broken logic rather than using the pickle compiler that comes with gherkin.

Jonas Amundsen
2019-10-10 07:52:32

They're on gherkin-5 and the previous API

Jonas Amundsen
2019-10-10 07:53:38

😂

Jonas Amundsen
2019-10-10 07:54:38

I fully expect that I'll be doing the upgrade, as this tool is rather unmaintained

Jonas Amundsen
2019-10-10 07:54:54

But in other words, it seems like this will get a bit easier with the most recent version of Gherkin

luke
2019-10-10 08:04:26

Do you know which gherkin 5 though? It could be that they're "just" behind on it?

Fail-safe check. try on gherkin 6. Before ruling this out

Aslak Hellesøy
2019-10-10 08:18:15

@luke they are on gherkin 5.1.0 - https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/bfdb5af466a2853937ecd2b209eb6129a79caeb9/package.json#L54

Aslak Hellesøy
2019-10-10 08:18:39

I don’t recommend gherkin 6 because of all that embedded go executable jazz. Gherkin 8 is better!

Jonas Amundsen
2019-10-10 08:22:15

Any idea when cucumber (npm) will update its dependency on gherkin?

Aslak Hellesøy
2019-10-10 08:23:44

Hard to say - nobody has started work on upgrading it to Gherkin8 AFAIK. My focus at the moment is to do the same for Cucumber-JVM.

Aslak Hellesøy
2019-10-10 08:24:47

Shortly after somebody submits a PR that works 🙂

Alex Jacinto
2019-10-15 11:38:15

@Alex Jacinto has joined the channel

Nick Gonzalez
2019-10-16 11:05:05

I am unable to run my cucumber tests with CircleCi. The installation seems to execute just fine, but the test runs through as a "Pass" without any scenarios or steps being run.

Does anyone have experience with this?

Cat
2019-10-16 12:42:50

*Thread Reply:* Where are you passing in step defs, etc?

Nick Gonzalez
2019-10-16 12:45:42

*Thread Reply:* I'm not sure that I understand the question

Cat
2019-10-16 12:48:51

*Thread Reply:* I'm not seeing --require anywhere. How are you telling cucumber where the step definitions are?

Cat
2019-10-16 12:49:06

*Thread Reply:* because it looks like it's just passing the formatter params

Nick Gonzalez
2019-10-16 12:50:10

*Thread Reply:* I am using tags to identify the features in which to run, but even still, when I run npm test, it should run the entire suite

Nick Gonzalez
2019-10-16 12:50:31

*Thread Reply:* Doing that works perfectly on my local machine

Cat
2019-10-16 12:51:53

*Thread Reply:* ok. let me rephrase that. in your package.json, how is npm test defined?

Nick Gonzalez
2019-10-16 12:52:19

*Thread Reply:* "cucumber-js -f json:report/cucumber_report.json"

Cat
2019-10-16 12:56:41

*Thread Reply:* Right. that is just telling cucumber the reporter you want to use. It's not telling it where the support code is.

Cat
2019-10-16 12:57:17

*Thread Reply:* unless you're doing that under the hood rather than via CLI

Nick Gonzalez
2019-10-16 13:00:35

*Thread Reply:* Oh. You might be on to something...

Nick Gonzalez
2019-10-16 13:08:26

*Thread Reply:* Is there documentation you could point me to

Nick Gonzalez
2019-10-16 13:08:27

*Thread Reply:* ?

Nick Gonzalez
2019-10-16 13:08:38

*Thread Reply:* I completely missed the --require portion

Cat
2019-10-16 13:16:10

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md

luke
2019-10-17 01:37:20

*Thread Reply:* yeh most of them you need to provide the location of step defs. I know some of the flavours have autoloaders if you put the steps in a certain place.

luke
2019-10-17 07:00:56

can anyone here help me get a very basic (i mean STUPIDLY BASIC), example of cucumber and js working with browser automation>

I was trying to get it working with a POM package, but I'll take just working against google.co.uk atm.

Cat
2019-10-17 07:53:56

*Thread Reply:* Sure, what are you using?

luke
2019-10-18 05:30:38

*Thread Reply:* i'll use whatever really. I just want something where i can do basic browser automation.

luke
2019-10-18 05:30:52

*Thread Reply:* we'll move on from that once i lose the training wheels. The problem I have is I only really understand ruby.

Cat
2019-10-18 05:32:56

*Thread Reply:* hm. have you looked at webdriverio?

Cat
2019-10-18 05:33:55

*Thread Reply:* I could throw a quick GH example up for you but realistically prob won't get time until later this evening (EST)

luke
2019-10-18 06:18:26

*Thread Reply:* that's fine. I tried wdio, I couldn't get it to work. I tried wdio (both selenium and non-selenium), i tried raw selenium (worked best but had some issues), cypress (not great), and all of them I couldn't reliably get to run.

I'm fairly certain I'm the issue here.

Cat
2019-10-18 06:20:39

*Thread Reply:* Nah, config + getting started is, hands down, the hardest shit 😄

Cat
2019-10-18 06:20:54

*Thread Reply:* Are you able to share what you've got so far?

luke
2019-10-18 07:01:01

*Thread Reply:* oh right, urm sorry. Was miles off.

luke
2019-10-18 07:01:30

*Thread Reply:* Kind of. Literally all i'm looking for is a sample to do page object model testing with js. The problem I have is it feels like the config files in js are 100s of lines compared to ruby which has 5-10 lines.

luke
2019-10-18 07:02:05

*Thread Reply:* https://github.com/site-prism/site_prism/blob/master/features/support/env.rb

That's the config file for site_prism (And some of that isn't needed for regular testing, its because its using travis)

Cat
2019-10-18 07:02:52

*Thread Reply:* as someone who went from Java/Groovy/Lisp code base to Javascript/Golang codebase: Forget everything you know about any other language before you proceed 😂

luke
2019-10-18 07:03:01

*Thread Reply:* if I can get a directory that has 1 feature, that loads up google and does a search and validates the results that would be epic. I know it sounds silly but I'm genuinely struggling to do that. But I know it's me that's the issue.

luke
2019-10-18 07:03:31

*Thread Reply:* Think lisp is similar to ruby in some aspects, or at least thats what matz (the creator), said.

Cat
2019-10-18 07:03:34

*Thread Reply:* no no, it's not you - even for experienced JS devs, getting configured and moving with browser automation is difficult

luke
2019-10-18 07:04:12

*Thread Reply:* im leaving work soon and won't be back until wednesday and plan on having a break. So don't sweat it.

If you can give me some pointers epic. But don't stress yourself too much.

Cat
2019-10-18 07:05:25

*Thread Reply:* no biggie! let me see if I can whip up just a basic config + cucumber + wdio example for you so you can see the gist of it

luke
2019-10-18 07:08:33

*Thread Reply:* take your time, but yes please feel free to help.

I try and do the same with ruby, but sadly it's getting less popular 😞

Amanda R
2019-11-05 13:30:22

*Thread Reply:* @luke did you ever get anything to work? im in the similar boat with JS and trying to learn

Cat
2019-11-05 13:44:51

*Thread Reply:* Sorry, I completely forgot about this!

Cat
2019-11-05 13:45:18

*Thread Reply:* I'm at work right now, but can whip up something pretty quickly once I get some free time (which I hear is a real thing, in spite of it being slightly mythological in my own personal life)

Amanda R
2019-11-05 13:46:33

*Thread Reply:* @Cat have you ever used nightwatch and cucumber?

Cat
2019-11-05 13:51:25

*Thread Reply:* lightly, but drivers are drivers 🤷

Amanda R
2019-11-05 13:57:31

*Thread Reply:* i haven't been able to get anything to work except cypress, so...i feel dumb about it all

luke
2019-11-06 00:02:21

*Thread Reply:* I tried nightwatch, but it kinda isn't right. Because it wasn't quite doing proper browser automation.

luke
2019-11-06 00:02:27

*Thread Reply:* but no I didn't get anything right

luke
2019-11-06 00:03:27

*Thread Reply:* well it is fine, it's just I found the configurability a bit too coupled. Frankly I don't care how I write the tests, so long as I can write some and maybe learn by doing it.

Cat
2019-11-06 07:55:49

*Thread Reply:* config hell is config hell 🙂

Cat
2019-11-06 07:55:54

*Thread Reply:* doesn't matter what tool

Cat
2019-11-06 07:57:08

*Thread Reply:* @Amanda R you said you couldn't get anything to work in cypress - could you elaborate?

Amanda R
2019-11-06 11:46:46

*Thread Reply:* yeah @Cat Cypress is the only thing i can get up and running

Amanda R
2019-11-06 11:47:16

*Thread Reply:* ive tried webdriverio and also nightwatch without any luck

Amanda R
2019-11-06 11:48:17

*Thread Reply:* ive worked with selenium at a past company but never had to deal with project set-ups

Cat
2019-11-06 11:52:30

*Thread Reply:* setup is the worstttttt

Cat
2019-11-06 11:53:15

*Thread Reply:* my recommendation: Start with cucumber. get it set up doing a basic scenario sans any other configs (e.g., get some steps like Given 2 / When I add 2 / Then I get 4)

Cat
2019-11-06 11:53:59

*Thread Reply:* Once you get that done, start with a very basic config to start your driver

luke
2019-10-17 07:01:18

I'm onto my 5th spike of different software combinations and I'm getting kinda pissed.

Aslak Hellesøy
2019-10-18 01:18:16

@luke are you using Cucumber-JVM or Cucumber.js?

luke
2019-10-18 02:43:52

well im trying to just get any sort of browser automation working with js, but I've tried so many different frameworks and they're all too confusing for me or they don't let me customise stuff. I think my lack of knowledge is biting me in the rear here.

Aslak Hellesøy
2019-10-18 02:44:36

So you’re using Cucumber.js? I got confused since you mentioned POM (which is Java)

Cat
2019-10-18 04:37:23

POM java or POM Page Object Model?

Cat
2019-10-18 04:37:43

(terminology is hard in this gig 😅 )

Azfar
2019-10-18 05:18:19

@Azfar has joined the channel

luke
2019-10-18 05:30:07

sorry Page Object Model yeh.

luke
2019-10-18 05:30:21

I'm sorta half trying to find something easy, because I need to learn js whilst doing it.

Azfar
2019-10-18 05:30:57

Is anyone configures ALLURE REPORT with Espresso plus BDD (Cucumber) Framework in Android Studio...? or Suggest any other Reporting Tool supported by Espresso with BDD (Cucumber) Framework...

Manoj
2019-10-18 08:14:02

aslak - modern terminology - POM - Page object model and not Maven POM 🙂

Aslak Hellesøy
2019-10-18 08:16:04

TIL a new TLA!

🙂 Manoj, mlvandijk
Manoj
2019-10-18 09:21:09

*Thread Reply:* Was nice meeting you in london during the conf!

Manoj
2019-10-18 09:21:20

*Thread Reply:* Next version is in India - June.

Aslak Hellesøy
2019-10-18 09:23:04

*Thread Reply:* I’d love to go - we’ll see

👍 Manoj
Manoj
2019-10-18 09:23:31

*Thread Reply:* you’re welcome anytime!

tooky
2019-10-18 08:46:37

https://media3.giphy.com/media/42D9p5goiPVU3l6wpe/giphy.gif?cid=6104955ec9304d856b0c0cacacd1c91912e9cb9cf5e97a0f&rid=giphy.gif

Houda B
2019-10-18 09:28:16

@Houda B has joined the channel

Jonas Amundsen
2019-10-22 06:02:12

I have another question about the behavior of cucumber.js and if cypress-cucumber-preprocessor diverges from it. In cucumber.js, if you define a step using eg. When("I press button"), can you invoke it from a feature file using Given I press button?

Jonas Amundsen
2019-10-22 06:03:29

Notice it's not worded according to (my) expectations. Will the framework enforce it or are the types transparent?

Aslak Hellesøy
2019-10-22 06:48:02

It will work. Cucumber is agnostic of the step keyword. This is by design.

Jonas Amundsen
2019-10-22 06:58:08

What's the rational behind this decision?

Aslak Hellesøy
2019-10-22 06:58:26

To discourage ambiguous language

Jonas Amundsen
2019-10-22 07:02:50

I see. I'm currently observing that the language of our tests is somewhat deteriorating when not every change is strictly reviewed. I appreciate quick feedback (hence I test) and strictness in tooling, hence I also naturally dislike ambiguity. What if types were taken into considering, but steps matching multiple registered definitions yielded a runtime error?

Jonas Amundsen
2019-10-22 07:04:23

And having the runtime error not take type into consideration, thus retaining the property of unambiguous language

Aslak Hellesøy
2019-10-22 08:11:44

We don’t want to allow the definition of two step definitions meaning different things. For example:

• Given(“I press button”) • When(“I press button”)

By allowing this, we’re also allowing ambiguous language to creep in

Jonas Amundsen
2019-10-22 08:18:09

I'm totally with you and I mean that one can validate this during runtime. If a step matches a definition residing in the Then-registry as well as the Given-registry, then that can be considered an error

Jonas Amundsen
2019-10-22 08:18:47

Just as I would consider a step matching multiple definitions an error today (albeit cypress-cucumber-preprocessor doesn't enforce that, it merely selects and invokes the 1st matching definition)

Aslak Hellesøy
2019-10-22 08:32:18

There is no Given registry or When registry. There is just stepdef registry. Are you suggesting we have different registries so that Given("I press button") cannot be used in a When - and that we don’t allow the same expression to be used across registries? I think that would be nice.

Jonas Amundsen
2019-10-22 08:33:18

Yeah, that's what I mean!

Aslak Hellesøy
2019-10-22 08:34:03

It shouldn’t be that hard to implement. We can still use just a single registry, but use a compound key for lookup (both the keyword and the gherkin step text).

Jonas Amundsen
2019-10-22 08:35:53

Given that the gherkin reference itself specifically stipulates different behavior, then I guess this suggestion affects not only cucumber.js, but all implementations?

Aslak Hellesøy
2019-10-22 08:43:09

Yes indeed. And here is a proposal for how we can better keep track of features that should be ported around: https://github.com/cucumber/repo-template/issues/4

aslakhellesoy (https://github.com/aslakhellesoy)
Labels
Feature Request, Triage
Comments
1
Jonas Amundsen
2019-10-22 08:49:36

Hmm, interesting. The behavior discussed here is about how a consumer of Gherkin treat the output. Cucumber.js might change to depend upon 8.x.x, but not yet exhibit these attributes. Do you think of this as a contract and that a change in it warrants a bump in Gherkin version, even if the change in Gherkin is merely in the documentation?

Aslak Hellesøy
2019-10-22 09:03:05

Gherkin just produces an AST (and pickles, which is a simplified representation) - it doesn’t interpret anything. So if we want to change semantics of how keywords and step definitions work, that’s a change in Cucumber

Jonas Amundsen
2019-10-22 09:07:21

Alright, but the behavior suggested here is surely a backward-incompatible change. And it seems that "varieties" describes "some feature set" that a developer can count on by grouping versions, but the cucumber version numbers are independent across implementations, right?

Jonas Amundsen
2019-10-22 09:08:52

So it seems like varieties doesn't allow for describing this, as long as it's only a version tuple of the dependencies

Aslak Hellesøy
2019-10-22 09:26:40

Varieties (or milestones as we might end up calling them) define any behaviour. It can be dependency on a particular library version (gherkin 8.1), or it could be a feature (must have a protobuf formatter). In this case, must distinguish between GWT in stepdefs - with a link to an issue describing it in more detail.

Jonas Amundsen
2019-10-22 09:28:21

Alright, all concerns accounted for 🙂

Jonas Amundsen
2019-10-22 10:45:39

I've tried to outline the above-mentioned proposal here btw: https://github.com/cucumber/cucumber/issues/768

badeball (https://github.com/badeball)
Fabricio Bedin
2019-10-23 06:32:23

@Fabricio Bedin has joined the channel

Saugat Pachhai
2019-10-23 23:13:36

@Saugat Pachhai has joined the channel

Saugat Pachhai
2019-10-23 23:53:52

Between retries, the default World is not getting cleared. Is this expected?

Saugat Pachhai
2019-10-23 23:54:36

Or, is this a known issue? Thanks in advance.

Jonas Amundsen
2019-10-24 04:19:16

It's me again, the cypress guy. So, the way cypress-cucumber-preprocessor works today is that it transforms the feature-file by parsing it using the old, native parser, and returns a template containing the AST [1], which uses Cypress' own test-constructors [2] (describe & it - from Mocha) to create tests. Since it works on the AST, it needs to re-implement EG. the expansion logic of scenario outlines. Consuming pickles would remove the need for re-implementing that specifically, but the pickles themselves doesn't contain the necessary information to re-construct the hierarchy of describe() and it() blocks. Any of you have any suggestions as how to best integrate these tools?

[1] https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/v1.16.2/lib/loader.js#L16-L19 [2] https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/v1.16.2/lib/createTestFromScenario.js#L37-L51

Templa
2019-10-24 15:20:36

@Templa has joined the channel

David Goss
2019-10-26 04:08:10

@David Goss has joined the channel

Dennis
2019-10-28 14:18:55

Good afternoon. I was handed an existing cucumber-js/selenium webdriver-js project to take over and I am unable to get driver.close() and driver.quit() to work on either Windows or Ubuntu on my local machine. They are located in world.js in the AfterAll hook. When executing the project in VS Code it leaves chrome.exe behind and on Ubuntu/Linux it leaves chrome files behind. I've tried different chrome options as well to no avail. In ubuntu, chromium-browser --version = "Chromium 77.0.3865.90 Built on Ubuntu , running on Ubuntu 18.04" and chromedriver --version: "not found" (however chromedriver is a dependency in package.json). I'm not sure why the setWorldContructor uses CustomWorld.bind(undefined, driver) as I haven't found any examples with this. I notice also that in my project in stepDefs.js another webdriver is created. I've included package.json dependencies, world.js, and the beginning of the stepDefs.js file in my project. Appreciate any help in advance.

Dennis
2019-10-29 06:08:30

Good morning. Please read previous message regarding driver.quit() not working. Thank you.

Marco Sanabria
2019-10-29 06:38:51

I see you’re catching any error there

AfterAll(function() {
  try {
    driver.close()
    driver.quit()
  } catch (error) {
    console.log('ERROR TRYING TO Quit' + error)
  }
})
Marco Sanabria
2019-10-29 06:39:48

is the runtime falling into that catch? If so, that would a good start to figure out what is going on

Dennis
2019-10-29 06:55:12

@Marco Sanabria Unfortunately no. 😞

Dennis
2019-10-29 07:00:23

How can I specify the path to the chromedriver.exe in the project? Can I do that in the world.js or a package.json script? (Besides using windows PATH environment variable.

Marco Sanabria
2019-10-29 07:53:48

you can use chromedriver package from npm https://www.npmjs.com/package/chromedriver

npm
Marco Sanabria
2019-10-29 07:54:35

you can see in the doc that when installing it, you can either force it to download it or specify the path

Marco Sanabria
2019-10-29 07:54:52

after that, you don’t have to specify the path anywhere in your code

Dennis
2019-10-29 08:38:08

@Marco Sanabria Wow. I've spent almost a full day on this. And as usual, such a simple fix. Made the function in the AfterAll hook async and then added 'await' to driver.close. Voila. That's the fun part of taking over stuff...learning all the nuances. Thanks for you help!

Marco Sanabria
2019-10-29 08:56:45

async/await that’s the beauty of working with promises 🙂

F. Kroos
2019-10-31 02:09:45

@F. Kroos has joined the channel

karamosky
2019-10-31 10:44:08

@karamosky has joined the channel

Greg Tonetti
2019-11-07 00:49:49

@Greg Tonetti has joined the channel

Kat
2019-11-13 12:08:04

@Kat has joined the channel

Sarah
2019-11-14 01:05:31

@Sarah has joined the channel

Francislainy
2019-11-15 09:03:50

@Francislainy has joined the channel

Mahtab Bahman Nejad
2019-11-19 08:04:01

@Mahtab Bahman Nejad has joined the channel

kerbe
2019-11-26 06:35:03

@kerbe has joined the channel

kerbe
2019-11-26 11:00:14

Gurus of Cucumber-js, I salute you. 🙂 Does someone have knowledge if cucumber-js is feasible to use with React Native (especially with Expo)? Is there some tutorial, that shows it with real examples? Or do you know some OSS project that uses cucumber-js in a way that can be studied to learn it's ways? I'm struggling with documentation alone to grasp this. And yes, I know that Jest is good... however I hope to get benefits of Gherkin syntax, and BDD, and I feel Jest sits nicely in TDD. I've struggled with this several days, but for some reason my brain just don't wrap around this. Any kind help guiding me forward, or even making confident statement that "No, you should not try to use cucumber-js with RN/Expo, it is waste of time", it would ease my mind and let me continue to next topic to learn & try out. 🙂

Aslak Hellesøy
2019-11-27 01:36:51

I’ve created an issue here @kerbe: https://github.com/cucumber/cucumber/issues/807

aslakhellesoy (https://github.com/aslakhellesoy)
Labels
type: docs
kerbe
2019-11-27 03:06:31

That would be great addition, and definitely make it easier to start. Or it might surface problems which need addressing too, if there are compatibility problems. 🙂

kerbe
2019-11-27 03:08:48

noticed also @matt-SmartBear's tweet. I will gladly help getting such tutorial done, with my limited knowledge. At least I can be good test subject, does it cover right things in understandable way. 🙂

Aslak Hellesøy
2019-11-27 03:38:45

@kerbe I haven’t done any React Native coding yet. Am I right that you can use Node.js as a development environment with it?

Aslak Hellesøy
2019-11-27 03:43:17

Yeah looks like it. So my understanding is that you can bootstrap an app with the expo-cli npm package. After bootstrapping I’d suggest building a tiny app with a button. When pressed, a counter is incremented. It would be TDD’ed with Cucumber.js

kerbe
2019-11-27 04:12:35

Yes, you are correct. expo-cli init is used to create project. I have then tried adding npm i cucumber, and created features/step_definitions folders. When I make simple feature file, run cucumber with ./node_modules/.bin/cucumber-jsI get steps to be added to steps file. Doing those, I get into point what is expected, having pending steps. But from here on I'm lost. How do I connect "right way" my RN code to these step files? If i try to import, I get error: SyntaxError: Cannot use import statement outside a module And here my understanding of docs/tutorials fade away, and I would like to see what I should do at this point.

kerbe
2019-11-27 04:14:02

It might, or might not matter that I use Windows 10 Pro. However my development environment is within WSL, as I like to operate under Linux. For some things this can cause problems, but shouldn't matter yet at that point.

matt-SmartBear
2019-11-27 04:29:17

@kerbe if you want to push some code to a repo I’d gladly take a look

kerbe
2019-11-27 04:31:08

Alright, I'll see if I get to do that this evening, tomorrow at day at latest. I'm just heading for meetings in few minutes for rest of the day.

matt-SmartBear
2019-11-27 04:32:38

Sure, no hurry. Ping me when you have something.

kerbe
2019-11-27 04:33:24

basicly steps file has this:

const assert = require('assert'); const { Given, When, Then } = require('cucumber'); import App from '../../App';

And that import gives syntaxerror. Code is otherwise I think from 10 minute tutorial.

kerbe
2019-11-27 04:33:31

But I can make repo of that later.

kerbe
2019-11-27 04:34:53

And also tried if something like const App = require('../../App'); would work, but then it gives error from import that is inside App.js

kerbe
2019-11-27 04:35:14

Anyway, need to leave now, I'll ping you once I have code pushed to repo.

Aslak Hellesøy
2019-11-27 05:02:16

@kerbe did you try to replace import with require ? In general, a codebase should settle on one or the other. Using import may require extra tooling to make the import syntax work. If you’re unfamiliar with this, I suggest you just use require

Jonas Amundsen
2019-11-28 06:00:08

I'm looking into what it would take to upgrade the gherkin-dependency in cucumber-js. At once I notice that generateEvents of gherkin-5 (ref. https://github.com/cucumber/cucumber/blob/gherkin/v5.2.0/gherkin/javascript/lib/gherkin/generate_events.js) resembles the messages generated by latest gherkin, except that they don't have a type property, but rather an inner object. Would you expect the update of the dependency to be a backward-incompatible change for all formatters or do you think we should try to retain the format of all events emitted?

Aslak Hellesøy
2019-11-28 06:03:24

Hi @Jonas Amundsen. Upgrading to the latest Gherkin in Cucumber.js is a backwards-incompatible change: • The Gherkin API has changed (method signatures, and more importantly, the use of protobuf objects) • The AST structure has changes (it’s now based on protobuf, but more importantly, there is a new Rule keyword / AST node)

Aslak Hellesøy
2019-11-28 06:03:45

So most formatters will break.

Aslak Hellesøy
2019-11-28 06:05:09

We’re in the process of re-implementing the formatters in the monorepo (outside cucumber.js). These new formatters will read cucumber messages (protobuf) as input.

Aslak Hellesøy
2019-11-28 06:06:16

Some of these new formatters (like the HTML one https://github.com/cucumber/cucumber/tree/master/html-formatter) are intended to work with any cucumber implementation, and must be installed separately.

Aslak Hellesøy
2019-11-28 06:07:51

Others (such as the pretty formatter, which users will expect to be available to cucumber without having to download a separate executable) will still have to be imlemented natively in TypeScript/Java/Ruby/C# etc, but because they are in the monorepo, we can use a shared set of tests for them to ensure they behave consistently.

Jonas Amundsen
2019-11-28 06:12:06

I see. Is there any reason to not attempt the upgrade, including the native formatters, other than that they will be changed further in the near future?

Jonas Amundsen
2019-11-28 06:13:19

It seems pretty straight forward given the current failing tests I'm looking at, so if no, I'll give it a shot

Aslak Hellesøy
2019-11-28 07:20:26

No reason - I think it would be great to upgrade if we can.

Jonas Amundsen
2019-12-01 05:34:30

@charlierudolph, are you already working on this btw? Ref. https://github.com/cucumber/cucumber/pull/814

charlierudolph (https://github.com/charlierudolph)
Reviewers
@aslakhellesoy
lokiOdUa
2019-12-01 23:00:58

@lokiOdUa has joined the channel

kerbe
2019-12-04 06:35:21

Looks like using requireinstead of importdoesn't make difference in React Native case.

kerbe
2019-12-04 06:38:20

I created simple repo with freshly initialized react native project with expo-cli @Aslak Hellesøy, it can be found here: https://github.com/kerbe/rn-cucumber It is in working state, meaning if you clone and npm install, you should be able to run npm test and get a start. However, this is point where right way is lost for me... That App.jshas that View and Text elements, and I would like to test that those exists. But if I try to require/import App.js to features/stepdefinitions/mainscreen.feature, I get errors, and I'm lost.

Language
<p>JavaScript</p>
Last updated
<p>4 minutes ago</p>
kerbe
2019-12-04 06:46:02

And I think it was also @matt-SmartBear who I was supposed to ping... so some basic code is in the repo, check message above 🙂

matt-SmartBear
2019-12-04 06:49:02

👋

matt-SmartBear
2019-12-04 06:49:08

busy week but I’ll take a look ASAP

kerbe
2019-12-04 06:50:32

appreciated. 🙂 I had surprisingly busy week too, so this took longer than I first thought.

kerbe
2019-12-11 12:26:11

Have you had any luck looking into react native (expo) / cucumber problem of mine?

Jon Beller
2019-12-12 12:17:44

Has anyone used the Screenplay Pattern? I have a feeling it would clean up my test code, but it seems intimidating to implement, since I can't use the only JS implementation I'm aware of, Serenity/JS.

tooky
2019-12-13 01:00:42

*Thread Reply:* ping @matt-SmartBear

tooky
2019-12-13 01:01:14

*Thread Reply:* We have been trying to distill what we learned into Feynman: https://github.com/cucumber-ltd/feynman

Language
<p>JavaScript</p>
Last updated
<p>6 months ago</p>
tooky
2019-12-13 01:01:49

*Thread Reply:* I don’t know if it has enough docs yet, or how usable it is for people who didn’t work on it yet, but feel free to have a poke around.

matt-SmartBear
2019-12-13 05:33:55

*Thread Reply:* @Jon Beller I’m writing a blog post series about it.

matt-SmartBear
2019-12-13 05:33:57

*Thread Reply:* AMA

matt-SmartBear
2019-12-13 05:34:54

*Thread Reply:* Is the first part

Jon Beller
2019-12-13 07:02:38

*Thread Reply:* Wow, awesome! Checking these out

matt-SmartBear
2019-12-13 11:56:05

*Thread Reply:* What’s stopping you from using Serenity, out of interest?

Jon Beller
2019-12-16 12:43:05

*Thread Reply:* I may have this wrong, but it looks like Serenity would be difficult to incorporate into my existing test suite that tests an electron app using Spectron, since it has Protractor baked in.

matt-SmartBear
2019-12-18 05:57:32

*Thread Reply:* Oh does it.

matt-SmartBear
2019-12-18 05:57:46

*Thread Reply:* Honestly, you can build your own screenplay framework in a few lines of code.

matt-SmartBear
2019-12-18 05:58:48

*Thread Reply:* See here for an example: https://github.com/mattwynne/screenplay-example/blob/b31cf1b3731b63a6d0da5c8912888f7823052749/features/step_definitions/steps.js

matt-SmartBear
2019-12-18 05:59:35

*Thread Reply:* Again, please ask me anything: I’m working on these series of article for someone just like you, so it would be really helpful to me to understand more about your context, what questions you have etc.

Des Horsley
2019-12-18 19:21:21

*Thread Reply:* @matt-SmartBear this is really exciting, I've been using blue harvest with Angular and its worked out well, but it looks like the project is no longer supported. Its been working well with cucumber, but still needs love. I'm glad to see that work is being done on an alternative.

Des Horsley
2019-12-18 19:22:18

*Thread Reply:* https://github.com/angular-seattle/blue-harvest

Stars
<p>57</p>
Language
<p>JavaScript</p>
Jon Beller
2019-12-19 06:51:07

*Thread Reply:* In this example, what is on this.abilities? It looks like name and app. Why do we treat those as "abilities"?

matt-SmartBear
2019-12-20 03:01:22

*Thread Reply:* OK @Jon Beller so in the screenplay metaphor, the abilities are “things the actor is able to do”. In this example, the actor has the ability to:

• recall their own name • make calls to the app’s JavaScript API Other abilities you might want to pass to the actor are things like a browser or a databaseConnection

Jon Beller
2020-01-02 13:11:36

*Thread Reply:* I have a concern that the Tasks aspects of the pattern would make our tests harder to debug compared to putting procedural logic directly in step definitions.

With procedural logic you can step through line by line with the debugger. In screenplay, your interactions execute in a loop inside attemptsTo, and then are hidden under layers of Tasks you'd have to step into and back out of.

Have you found this to be an issue?

Jon Beller
2020-01-02 13:15:13

*Thread Reply:* I'm also concerned it will be tempting to shove one-off scenario-specific logic or conditionals into Tasks, making it difficult to reuse them, or to know what you're breaking if you modify them.

matt-SmartBear
2020-01-06 04:52:10

*Thread Reply:* re. debugging, to be honest I haven’t notice that to be much of an issue, no. Would it not be possible, depending on where you put your attemptsTo function (you could use https://github.com/cucumber-ltd/feynman/) to have your debugger step over the infrastructure and stay in your task functions?

matt-SmartBear
2020-01-06 04:53:57

*Thread Reply:* I think it’s generally OK to have quite scenario-specific one-off tasks. What I see happen is that those tasks tend to get decomposed into smaller re-usable pieces, either tasks or actions. The smaller those pieces are, the less likely it is that you’ll want to modify them in future, so there’s less risk of that “what will I break if I change this” problem, I think.

matt-SmartBear
2020-01-06 04:54:22

*Thread Reply:* I might be good to talk about a specific example here. Do you have one?

smacpherson64
2019-12-16 07:00:39

@smacpherson64 has joined the channel

giang ha
2019-12-18 20:36:47

@giang ha has joined the channel

Fernando Távora
2020-01-03 09:23:06

@Fernando Távora has joined the channel

Vu
2020-01-03 14:00:26

@Vu has joined the channel

Vu
2020-01-03 14:01:01

Hi everyone

Prashant
2020-01-06 22:13:10

@Prashant has joined the channel

kerbe
2020-01-07 05:42:23

Happy new decade everyone! 🙂 @matt-SmartBear have you had chance to look into React Native (Expo) & Cucumber-js problem I had last year?

matt-SmartBear
2020-01-07 06:04:40

*Thread Reply:* Shit, no not at all. I dropped the ball, sorry.

matt-SmartBear
2020-01-07 06:05:15

*Thread Reply:* Can you remind me?

kerbe
2020-01-07 06:05:52

*Thread Reply:* If you look this channel upwards, in beginning of December, might be easiest reminder?

kerbe
2020-01-07 06:06:16

*Thread Reply:* https://cucumberbdd.slack.com/archives/C6QJ6N695/p1575470121133000 << like that was last time it was talked about

Joonas Hämäläinen (https://cucumberbdd.slack.com/team/UQN9GDSRZ)
kerbe
2020-01-07 06:06:53

*Thread Reply:* And original problem was this: https://cucumberbdd.slack.com/archives/C6QJ6N695/p1574794814100000

Joonas Hämäläinen (https://cucumberbdd.slack.com/team/UQN9GDSRZ)
kerbe
2020-01-07 06:08:31

*Thread Reply:* It relates also to this issue: https://github.com/cucumber/cucumber/issues/807 as hopefully result of my problem is solving that issue, ie. providing good example how cucumber-js is used with react native.

aslakhellesoy (https://github.com/aslakhellesoy)
Labels
type: docs
Vu
2020-01-07 15:57:43

does anyone knows if there is a plugin for cucumber-js that allows me to get code coverage for an react-app?

Raymond
2020-01-07 16:05:29

I believe https://github.com/istanbuljs/nyc would work

Website
<p><a href="https://istanbul.js.org/">https://istanbul.js.org/</a></p>
Stars
<p>3949</p>
Vu
2020-01-07 16:33:39

*Thread Reply:* thanks, but I was hoping for something else. I already tried it with jest which include nyc, but I will give it another try with mocha

Raymond
2020-01-07 16:44:27

*Thread Reply:* Hmm why did it not work? I don't think there should be a difference between jest and mocha in this case I haven't run it with jest but I did run it with Mocha and it worked, heres an example of the script I ran

"test:coverage:cucumber": "nyc --nycrc-path=spec/unit/.nycrc-v1.json npm run cucumber:regression"test:coverage:cucumber - What I named my npm script • nyc --nycrc-path=spec/unit/.nycrc-v1.json - Calling Istanbul and the profile • npm run cucumber:regression - My cucumber tests

Vu
2020-01-07 16:50:20

*Thread Reply:* sorry I should clarified what my issue really is. I am trying to integrate cucumber js for my bdd testing. I was able to do that with a simple create-react-app typescript template. I am trying to achieve two things here. 1) create a json report for my bdd feature files (was able to do that) 2) create a code coverage report(inprogress of figuring it out). I know jest can give me a code coverage report, but it doesn’t integrate well with cucumber-js

Raymond
2020-01-07 16:55:11

*Thread Reply:* I guess I don't understand, what you are saying. If you have cucumber working and test running then you just need to create an istanbul profile of what code you want it to look at and what level of reporting. Then you just call your test run with nyc

nyc *nyc-profile* *process to run*

In this case the process to run is your test suite ^ that could be jest, mocha, cucumber etc

Vu
2020-01-07 17:11:30

*Thread Reply:* thanks I think I figure out what you are saying. Sorry I am still new to testing. Thank you for guiding me through this.

Raymond
2020-01-07 17:11:52

*Thread Reply:* No problem, feel free to ping here again if you have more questions

👍 Vu
kerbe
2020-01-08 10:54:18

*Thread Reply:* @Vu could you share how you have setup your cucumber-js + react native? I tried doing similar with expo, but didn't get easily cucumber-js working. Your setup steps could give me necessary direction what to do, so I'll get forward too. 🙂

Vu
2020-01-08 15:28:12

*Thread Reply:* @kerbe I didn’t used react native, but react. All I did was install cucumber and set the script in my package.json.

Vu
2020-01-08 15:28:39

*Thread Reply:* I used a simple create-react-app for my integration.

Vu
2020-01-08 15:29:37

*Thread Reply:* this is my package.json

kerbe
2020-01-08 15:29:44

*Thread Reply:* Ah, my mistake. I somehow managed to read / understand that you had used react native. 🙂

kerbe
2020-01-08 15:30:14

*Thread Reply:* Thank you for replying though. 🙂

Vu
2020-01-08 15:30:45

*Thread Reply:* yeah sorry I never used react-native, I don’t know how big of a difference between the react and react-native configuration

kerbe
2020-01-08 15:31:55

*Thread Reply:* Too big for cucumber-js to "just work" like it does with react. 🙂 As I haven't used that much of react, seeing talk about Jest equalled in my head that it is react native project. 😄

kerbe
2020-01-08 15:32:20

*Thread Reply:* I'll continue trying to find way to get this work. 🙂

Vu
2020-01-08 15:33:22

*Thread Reply:* create-react-app script used jest as their default test-runner. I just simply replace with cucumber-js

Vu
2020-01-08 15:33:25

*Thread Reply:* but good luck

Raymond
2020-01-08 15:57:07

*Thread Reply:* Did the coverage work? Also you shouldn't need ./node_modules/.bin in your scripts as npm knows to look in there for commands, and they default to using the local libraries

Vu
2020-01-08 15:57:52

*Thread Reply:* yeah it did

Vu
2020-01-08 15:59:16

*Thread Reply:* and also thanks didn’t know that

Raymond
2020-01-08 17:08:29

*Thread Reply:* Sweet. Glad it worked

Viktar Silakou
2020-01-08 23:09:14

@Viktar Silakou has joined the channel

Viktar Silakou
2020-01-08 23:09:42

Hi guys, how can I get a feature name from hooks?

slackbot
2020-01-08 23:09:43

Hi! "Guys" is easily replaced with the more gender-neutral "Folks", "All" or "Foolish mortals". We'd appreciate if you tried to use that. Thanks!

luke
2020-01-09 00:44:03

@Viktar Silakou scenario.name will return the scenario name object. For other methods just operate on the scenario object.

Viktar Silakou
2020-01-09 00:44:40

@luke I don’t want a scenario name but feature name

luke
2020-01-09 00:48:48

As I said, just check what methods are exposed on the scenario object.

for ruby you have the following

(scenario.methods - Object.methods).sort =&gt; [:__getobj__, :__setobj__, :accept_hook?, :all_locations, :all_source, :around_hooks, :describe_source_to, :describe_to, :exception, :failed?, :feature, :keyword, :language, :location, :marshal_dump, :marshal_load, :match_locations?, :match_name?, :match_tags?, :method_missing, :outline?, :passed?, :source, :source_tag_names, :status, :step_count, :tags, :test_steps, :with_around_hooks, :with_result, :with_steps]

luke
2020-01-09 00:49:20

0&gt; scenario.feature.name =&gt; "Update a thing" ``````

Viktar Silakou
2020-01-09 00:50:20

This not the case for js

luke
2020-01-09 00:52:30

right, but what I've just said is. If you check what methods are exposed on the scenario object in the hook, that will tell you all you need to know.

Viktar Silakou
2020-01-09 00:53:17

where i can read docs about the scenario object?

luke
2020-01-09 00:56:04

if you try getCurrentFeature().getName(); that should work.

luke
2020-01-09 00:56:19

ssuming the api is setup in the same way. But I've not used the js implementation much sadly sorry.

luke
2020-01-09 01:00:15

those docs are more of a holistic view of how to view something. I would look into the npm package (Again I'm not a JS user so I can't be much help).

If you think that kind of info should live in the docs, edit the page and make an addition it would be most useful.

🎯 Cat
Viktar Silakou
2020-01-09 01:00:27

Thank’s i will try it, currently i use wdio hooks for this purpose

lingesh
2020-01-13 09:01:01

@lingesh has joined the channel

kerbe
2020-01-14 01:04:53

Has @matt-SmartBear or @Aslak Hellesøy had chance to check my problem yet? Reminder, it's getting cucumber-js to work with React Native, specifically with Expo. Basic repo for problem: https://github.com/kerbe/rn-cucumber

Language
<p>JavaScript</p>
Last updated
<p>a month ago</p>
Aslak Hellesøy
2020-01-14 03:32:19

@kerbe no, haven’t found the time yet.

James Xiu
2020-01-15 09:54:44

@James Xiu has joined the channel

Linda Padilla
2020-01-16 09:49:25

@Linda Padilla has joined the channel

Des Horsley
2020-01-20 19:52:00

Hi all, I was hoping to get parallel tests running in cucumberjs, I'm running cucumber on an angular project, is this possible at the moment?

I've found the documentation on parallel builds here: https://cucumber.io/docs/guides/parallel-execution/

But there is no js guide.

Cat
2020-01-21 05:55:34

*Thread Reply:* Highly recommend the cucumber-js specific docs: https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#parallel-experimental

Cat
2020-01-21 05:55:53

*Thread Reply:* (ignore the first link, we were debating how to dress for a work event)

Des Horsley
2020-01-21 15:40:37

*Thread Reply:* Thanks @Cat I had come across that. I'm not sure how to translate that into my protractor setup, my undstanding is that angular kicks it all off under the hood. I've updated my cucumberOpts in protractor.conf.js to include the following (Just to cover my bases): PARALLEL: true, TOTAL_SLAVES: '10', parallel: true, total_slaves: '10', format: [ 'json:reports/e2e-reports/results.json' ] If I don't pass in the total slaves as a string I get an error about an unexpected path.

Running the tests with the above code doesn't seem to provide any time advantage, or produce multiple outputs which I thought would happen (One for each process?)

Any thoughts?

Cat
2020-01-22 05:28:39

*Thread Reply:* ahhhh, if you're kicking it off with the protractor runner you will want to specifically look at the protractor docs. It may or may not be supported.

Des Horsley
2020-01-22 16:21:20

*Thread Reply:* Okay thanks, I'll see how I go

Jennifer Coleman
2020-01-24 09:44:16

@Jennifer Coleman has joined the channel

Yehuda Miller
2020-01-26 04:56:53

@Yehuda Miller has joined the channel

Yehuda Miller
2020-01-26 05:01:16

Hi there. Long time Cucumber user but I'm looking to use it for something a bit unique. I am wondering if I can call an internal function (maybe with Gherkin) to get an array of all scenarios which would be run in the current configuration (taking tags into account).

Cat
2020-01-27 04:57:10

*Thread Reply:* What's the use case?

Yehuda Miller
2020-01-27 23:14:22

*Thread Reply:* Thank you for responding. I'm using Protractor and Cucumber together and it seems really difficult to parallelize tests with that combination. My idea is to gather the list of scenarios which will be run, split them up evenly, create several cucumber "rerun" files, and then run my tests using the cucumberOpts.rerun option. This way I can parallelize them evenly instead of just using shardTestFiles which breaks the tests up by feature file.

Yehuda Miller
2020-01-26 05:01:23

Does anyone know of a way to do this?

Rajeev Kumar
2020-01-27 10:01:27

@Rajeev Kumar has joined the channel

David Goss
2020-01-27 12:43:26

@Yehuda Miller haven’t tested but you might be able to:

• use the —dry-run flag to stop the steps running for real • write a custom formatter to build your array of scenarios https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md

Would be interested to hear the motivation for this

Adam
2020-01-29 07:43:18

@Adam has joined the channel

Adam
2020-01-29 07:44:39

Hi friends! Hopefully a simple question: How do I hover an element? Our navbar requires hovering to activate a dropdown

Cat
2020-01-29 07:51:17

*Thread Reply:* This isn't a cucumber question. This depends entirely on what you're using as a driver.

☝️:skin_tone_3: Gem
Adam
2020-01-29 07:52:43

*Thread Reply:* Our steps are written in gherkin. Does that help? Sorry, I'm very new to this system.

Aslak Hellesøy
2020-01-29 07:54:46

*Thread Reply:* This sounds like a question about Selenium WebDriver @Adam - they have their own community

🎯 Cat, Gem
Adam
2020-01-29 07:59:16

*Thread Reply:* Thanks. There's so little documentation with this system we're using that I'm having to run in circles to get any information.

Cat
2020-01-29 08:01:47

*Thread Reply:* If it's in js, you can look at the package.json to see what dependencies are being leveraged

matt-SmartBear
2020-01-29 16:48:23

*Thread Reply:* @Adam Cucumber runs the tests for you (and reports the results), but something will be being called from the javascript code in those tests that is automating the browser. Could be selenium but could be something else too. What kind of app is it you’re testing?

Thomas Stuttard
2020-01-29 09:02:23

@Thomas Stuttard has joined the channel

vaibhav Barmkar
2020-01-29 22:57:47

@vaibhav Barmkar has joined the channel

heron
2020-02-05 08:49:33

@heron has joined the channel

Jean-Philippe Poulin de Courval
2020-02-05 09:01:44

@Jean-Philippe Poulin de Courval has joined the channel

Jonas Amundsen
2020-02-06 04:10:47

Is there a timeline for publishing latest changes, particularly the updated dependency on gherkin? 🙂

luke
2020-02-06 04:50:20

as we're an open source project it'll get done when it's done. I know it's one of the items people are working on a lot, but gherkin has gone through a couple of major revisions recently. So it's just going to take some time.

Jonas Amundsen
2020-02-16 07:05:50

*Thread Reply:* I totally get that and I didn't mean to imply anything. "No" is a perfectably acceptable answer here.

Fredrik Sundqvist
2020-02-11 09:21:21

@Fredrik Sundqvist has joined the channel

Arkadiusz Oleksy
2020-02-11 22:35:49

@Arkadiusz Oleksy has joined the channel

Marc NOEL
2020-02-12 09:14:30

@Marc NOEL has joined the channel

Gary Thomas
2020-02-12 11:50:57

@Gary Thomas has joined the channel

luke
2020-02-18 05:51:12

Does anyone here use cypress and cucumber. I think I've found a good guide to get a basic sample setup working, but I'm not 100% on bits of it.

Cat
2020-02-18 05:52:32

*Thread Reply:* to use cypress with cucumber, you have to use a pre-processor. We opted to simply not use cypress with our cucumber implementation, honestly. It wasn't worth the hassle.

luke
2020-02-18 06:07:18

*Thread Reply:* I've got some sample project here: https://medium.com/@itortv/how-to-integrate-cypress-and-cucumber-in-your-development-flow-in-just-a-few-weeks-96a46ac9165a which seems simple enough.

I'm still struggling to get something that combines the 2 aspects I previously had which both worked.

A seleniumJS raw script which I could pause and debug. And proper tests written with POM and classes / functions e.t.c.

Medium
Reading time
15 min read
Ayethin
2020-02-18 06:14:01

*Thread Reply:* I have this project that does POM: https://github.com/healthbridgeltd/ui-tests-boilerplate

Stars
<p>1</p>
Language
<p>JavaScript</p>
luke
2020-02-18 06:18:17

*Thread Reply:* I'll take a look at that @Ayethin - I think one thing I really need is just a mini-sitdown session to get it working the way I can get stuff working in ruby, So debuggable / viewable e.t.c.

👍 Ayethin
Ayethin
2020-02-18 06:19:28

*Thread Reply:* yeah, that is slightly out of date, but should hopefully help

luke
2020-02-18 06:19:30

*Thread Reply:* I'm struggling to get cypress to pause during execution in my code in RubyMine - Raw Selenium works, so it's either something simple I'm doing wrong or some misunderstanding I have.

Ayethin
2020-02-18 06:37:04

*Thread Reply:* you can pause with .debug() or just from the browser itself with the built in debugger if that is what you are after. Outside of that I don't know any way

luke
2020-02-18 06:37:32

*Thread Reply:* neither are working properly. Because I'm still a newbie. I think I've got this project 75% working. There was some bugs in the selectors.

luke
2020-02-18 06:37:47

*Thread Reply:* Big issues I've got atm.

Output response Speed Config debugging

luke
2020-02-18 06:38:03

*Thread Reply:* everything is super obfuscated.

Cat
2020-02-18 07:13:35

*Thread Reply:* to my knowledge, debug() is the way to go for that. That said? Even with an army of expert frontend developers well-versed in automation infrastructure, we've had TONS of issues with even traditional mocha cypress implementation stability so, frankly, the issue very well may not be on you =|

luke
2020-02-18 07:21:00

*Thread Reply:* I just mean using my IDE and putting a red stop sign on a line of code. then clicking play,.

luke
2020-02-18 07:21:27

*Thread Reply:* it works in ruby (obviously), but it also works in raw selenium code. But for some reason using cypress or other stuff makes it not work. I've not got the knowledge to work out why.

luke
2020-02-18 07:22:05

*Thread Reply:* Also I'm not comfortable in changing cypress config yet (let alone on the fly), so I'm testing in electron which is super bad.

luke
2020-02-19 01:59:14

*Thread Reply:* I managed to get the cypress cucumber one working quite reliably now. The main issue I have now is that of debugging / traceability.

I.e. when I run it outputs an xml file with no stacktrace (or a complex one), I want a nice easy stacktrace to work out what line is failing, and also a way to get things like logging to file and browser config working. But I made ok progress.

👍 Ayethin
Cherif Bouchelaghem
2020-02-28 16:31:42

@Cherif Bouchelaghem has joined the channel

Raymond
2020-02-28 17:26:41

In the upcoming TS release are the cli helpers such as getTestCasesFromFilesystem being removed? I can't seem to see them. Perhaps they have been renamed

binarymist
2020-12-01 01:44:37

*Thread Reply:* I'm guessing this is no longer available? I can see the code in cucumber.js but it doesn't appear to be accessible

binarymist
2021-03-13 18:11:13

*Thread Reply:* Still struggling with this (https://github.com/cucumber/cucumber-js/issues/1489) @Aslak Hellesøy

binarymist (https://github.com/binarymist)
Labels
🍼 incomplete
Comments
10
Gary Easton
2020-03-05 02:46:43

@Gary Easton has joined the channel

matt-SmartBear
2020-03-17 04:45:06

Given that cucumber-js does not have a --watch option, how are people running their tests automatically on file changes?

Cat
2020-03-17 06:57:44

*Thread Reply:* Real talk: I don't 🙈 We have a @wip tag for running scenarios/features under active development and I just hit that script. That said, it's mostly because we just haven't had time/prioritization to fiddle with a watcher. One of the FEs in my org would probably have a much cleverer solution 😁

Raymond
2020-03-20 15:28:13

*Thread Reply:* Honestly I never even thought of implementing a watcher, but what I would recommend using if you wanted to add a watcher is using gulp https://gulpjs.com/docs/en/api/watch This will work with typescript too

matt-SmartBear
2020-03-17 04:45:27

(and for bonus points, what if you’re using typescript?)

Marienel Ortiz
2020-03-31 16:55:48

@Marienel Ortiz has joined the channel

Mark Flarup
2020-04-05 22:59:37

@Mark Flarup has joined the channel

jradom
2020-04-06 12:35:24

@jradom has joined the channel

jradom
2020-04-06 12:36:26

can someone please suggest how can I do the following? Let’s say I have a step where I create a variable= X. The I have next step where I want to use X as input value. Similar I want to pass data from one scenario to the other. We use Typescript as main language. Any help will be greatly appreciated

Cat
2020-04-07 05:46:51

*Thread Reply:* Generally speaking, passing data from one scenario to another is considered an anti-pattern. Ideally, you want to keep them as separated as possible. Could you give an example of the sort of use-case you're trying to implement?

👍 Mark Flarup
Cat
2020-04-07 05:47:01

*Thread Reply:* Usually you can get around them without anti-patterns 🙂

jradom
2020-04-08 13:54:17

*Thread Reply:* What about from one step to another?

Cat
2020-04-09 06:22:51

*Thread Reply:* Can you give an example of what you're trying to do?

Steven Hunt
2020-04-15 19:09:21

*Thread Reply:* @jradom https://stackoverflow.com/a/61241558/1267688 here is an example of how to pass data between steps. As for passing between scenarios, it's possible but not recommended because it violates test isolation between scenarios.

Stack Overflow
olu olu
2020-04-07 21:12:19

@olu olu has joined the channel

olu olu
2020-04-08 01:09:32

can someone help?How do i execute tree

it says no such command found .... debian secondly how do i open or run on windows?

Mark Flarup
2020-04-08 04:25:30

*Thread Reply:* First of all: no need to post your question twice 🙂 You need to install it through apt install tree. You might need root permissions (prefix with sudo, sudo apt install tree. I cannot answer your question related to Windows.

olu olu
2020-04-09 04:25:20

*Thread Reply:* Thanks , this helps a lot

olu olu
2020-04-08 01:11:41

can someone help? How do I execute tree command

it says no such command found... Debian secondly, how do I open or run on windows? Thanks

Kevin Abatan
2020-04-10 00:35:09

@Kevin Abatan has joined the channel

Bhaskar Siriki
2020-04-14 00:24:23

@Bhaskar Siriki has joined the channel

Thomas G Henry
2020-04-14 06:58:41

@Thomas G Henry has joined the channel

Ludwig Magnusson
2020-04-14 07:15:58

@Ludwig Magnusson has joined the channel

Thomas G Henry
2020-04-14 07:16:01

fwiw here's my cucumber.js I do use babel.

module.exports = { default: `--format-options '{"snippetInterface": "synchronous"}' --require-module @babel/register --require-module @babel/polyfill --require-module ./node_modules/cypress --require ./cypress/support/step_definitions/` }; I'm not sure how necessary some of these requires are, but that's the state of things now as I experiment.

Thomas G Henry
2020-04-14 07:16:08

When to follow

Ludwig Magnusson
2020-04-14 07:16:50

@Thomas G Henry can you wrap yur code in three ` on each side here in slack? Makes it much easier to read 🙂

Thomas G Henry
2020-04-14 07:17:31

*Thread Reply:* It was a copy paste from the other channel. the backticks didn't make it 😊 updated now

Thomas G Henry
2020-04-14 07:18:15

// When(/^I login as {string}$/, (role: string) =&gt; { // When('I login as {string}', function(role) { When('I login as Faculty', function() { // console.log(role); // const username = getUserFromRole(role); // const dashboardEndpointOverrides = getDashboardExpectationsFromRole(role, 'Root'); // console.log(username); // console.log(dashboardEndpointOverrides); // loginWithSSO(username, dashboardEndpointOverrides || ['/']); return 'pending'; });

Ludwig Magnusson
2020-04-14 07:18:30

Not sure bout any of this but you should probbly only require cypress and not ./node_modules/cypress

Thomas G Henry
2020-04-14 07:20:33

*Thread Reply:* I had to fiddle with this a bit when I trying to run cucumber directly, but now I have picklejs in the mix and that seems to run cucumber from cypress, so I might not even need that at all anymore. I'll take it out now to see if that even matters.

Thomas G Henry
2020-04-14 07:18:36

mostly comments now, but left there to show things attempted. right now it blows up doing almost nothing

Thomas G Henry
2020-04-14 07:21:25
Sachin Fegade
2020-04-14 07:21:36

@Sachin Fegade has joined the channel

Thomas G Henry
2020-04-14 07:21:46
Thomas G Henry
2020-04-14 07:22:25

last one...

Sachin Fegade
2020-04-14 07:23:41

@Sachin Fegade has left the channel

Thomas G Henry
2020-04-14 07:24:58

per the picklejs doc I have the step def dir under cypress. Maybe that features isn't in the root of the project is causing weirdness? They're being found, but maybe the unexpected location is having side effects. I'll play with the config, per the other thread and move the features around, and get back here. thanks, all!

Thomas G Henry
2020-04-14 08:19:17

Sorry, Friends. Had to take a call. So, here's the config:

module.exports = { default: `--format-options '{"snippetInterface": "synchronous"}'` };

Requiring babel and cypress no longer appear to matter at all. (they were leftover from calling cucumber directly, as opposed to via picklejs as I do now)

Also, I made a link to ./cypress/support/step_definitions from ./features/step_definitions

none of the above appear to have made a difference in this.cwd not being a string when resolving the step defs.

Thomas G Henry
2020-04-14 14:18:50

When isn't When When? When it's from "cypress-cucumber-preprocessor". Switching to that one from the vanilla cucumber one was what I needed. And it only cost me a day! haha

ec-mark
2020-04-15 05:39:41

@ec-mark has joined the channel

ec-mark
2020-04-15 05:42:32

Hello! Is there a way to (more) gracefully interrupt a running test? Our tests tend to be long running, and our platform has some UI where we’d like to be able to stop a test

Cat
2020-04-15 06:15:52

*Thread Reply:* More gracefully than...? You have a few options built in (for example: setting the timeout at config level), and there are a few things you could implement yourself.

Cat
2020-04-15 06:16:52

*Thread Reply:* Usually it's helpful to identify long-running scenarios and either break them into shorter scenarios or identify the underlying cause of poor performance and remedy it

💯 Gem
ec-mark
2020-04-15 08:16:15

*Thread Reply:* Hi Cat, some more details: Our tests are a little unique, in that we’re testing videos, which can take some time before we make our assertions. So, we necessarily have some cucumber steps where we start something happening and we simple have to wait some time.

ec-mark
2020-04-15 08:17:02

*Thread Reply:* One way I found to stop a test is in the world, I listen for a stop event. If one occurs, I throw a “Test stopped” error in the world itself.

ec-mark
2020-04-15 08:17:19

*Thread Reply:* Sometimes it works, but not reliably I guess

Cat
2020-04-15 08:27:37

*Thread Reply:* Hm. So basically Given I go to MyPage When I click MyVideo And I wait for the video to play Then I see &lt;whatever the completed state is&gt; Right? So when you say you're listening for the stop event - do you mean the video has unexpectedly stopped before it has completed? (trying to make sure I understand the scenario)

Cat
2020-04-15 08:30:07

*Thread Reply:* If that's wrong, you can send me a (sanitized, if you need to) scenario so I grok it and I can help 🙂

ec-mark
2020-04-15 08:32:17

*Thread Reply:* Hi Cat, your scenario is pretty close, so let’s go with that. So, let’s say that scenario is running, and currently we’re waiting for 10 minutes worth of video to play.

We have some UI that let’s us monitor running tests. In some cases, we might have to cancel the test manually. So, we have a button on the UI, and we can send a stop request to our server.

ec-mark
2020-04-15 08:33:03

*Thread Reply:* So, we’d like to be able to stop the test from outside cucumber, but still allow it to execut after hooks

Cat
2020-04-15 08:54:32

*Thread Reply:* Hm. To my knowledge, canceling the entire process manually would not allow you to execute the after hooks since it would end the entire process. However, you could ditch the after hooks and implement them as before hook cleanup and bypass the entire issue potentially

Cat
2020-04-15 08:55:09

*Thread Reply:* alternatively, you could write an entirely separate script that runs independently that could be executed manually upon manually stopping the tests.

ec-mark
2020-04-15 09:07:01

*Thread Reply:* okay, will look into that, thanks. sounds like there’s no way natively in the library to “interrupt” the steps. thanks for your time 🙂

Cat
2020-04-15 09:11:17

*Thread Reply:* Short of setting a timeout or conditional stop, no, not that I can think of off the top of my head - that would not work with the manual stop use case though =|

👍 ec-mark
Gem
2020-04-15 09:17:05

*Thread Reply:* I've written automation with video and it can suck given the set time restraint based on video playback. 😞

Gem
2020-04-15 09:17:13

*Thread Reply:* Good luck Mark!

ec-mark
2020-04-15 09:17:54

*Thread Reply:* Yep, definitely an “interesting” challenge 😉

ec-mark
2020-04-15 09:17:56

*Thread Reply:* thanks!

Gem
2020-04-15 09:21:06

*Thread Reply:* hahah. That's a word for it!

Gem
2020-04-15 09:22:45

*Thread Reply:* If possible, I'd recommend trying to use short videos wherever possible. Also, if you know the length of the video, you can put in a wait for the duration before moving on so that if things hang, you're not sitting indefinitely at least.

I know always using short sources isn't possible, especially since some issues only present themselves in long running sessions.

ec-mark
2020-04-15 09:24:15

*Thread Reply:* Thanks, yeah that’s exactly the issue. We do use short videos when possibly. But we’re actually measuring latency drift in long running videos, so that’s where this scenario comes up. Sometimes we actually have to let the video run up to 3 hours!

Gem
2020-04-15 09:37:31

*Thread Reply:* Ah, yep! Good luck. 😛

tooky
2020-04-16 05:47:29

*Thread Reply:* @ec-mark this might sound crazy… and I’m a complete amateur to your domain… but….

I wonder if an automated test like this is the best way to measure something like that.

Is it possible to think of a way to test latency drift in production?

I mean instrument the app in someway to provide you the data you need while users are actually playing videos? You could then have alerts if things start to go out of the boundaries you set for normality.

Cat
2020-04-16 05:50:38

*Thread Reply:* ^^ That would actually be my suggestion as well, @tooky. It's how I would measure poor performance in, say, a long-running date aggregation. I don't see why the same principle couldn't be applied to videos.

:highfive: tooky
Frédéric Espiau
2020-04-15 09:13:33

@Frédéric Espiau has joined the channel

Steven Hunt
2020-04-15 17:25:16

@Steven Hunt has joined the channel

Vitali Hanich
2020-04-17 04:33:12

@Vitali Hanich has joined the channel

Marina33
2020-04-17 11:01:02

@Marina33 has joined the channel

Richard
2020-04-18 09:41:12

@Richard has joined the channel

Angelo
2020-04-20 13:32:19

@Angelo has joined the channel

Fátima Flores
2020-04-21 22:40:11

@Fátima Flores has joined the channel

Sachin More
2020-04-23 14:03:07

@here i am starting new project with cucumberJS and trying to setup project structure. However, i see that we need to have step definitions and feature files in feature directory ..is there any way we can override this setting? like we specify glue path in cucumber-jvm which links feature to step definitions..is similar option available in cucumber js?

Marco Sanabria
2020-04-23 17:31:44

depending on the framework you’re going to use you can specify the cucumber options to tell where to find the steps definitions and the support files

Marco Sanabria
2020-04-23 17:35:13

For example, this is the object I set on my protractor.conf.js

Sachin More
2020-04-24 08:38:03

*Thread Reply:* I am not using any other framework…using cucumber for writing automation tests and have own library built for invoking rest apis

Sachin More
2020-04-24 10:57:16

*Thread Reply:* Ok, i figured this out…we can achieve this using profiles in CLI…Thanks you !!

Constantinos M.
2020-04-24 03:31:25

@Constantinos M. has joined the channel

Kostas Tzoulas
2020-04-24 13:01:32

@Kostas Tzoulas has joined the channel

Mithat
2020-04-26 16:42:10

@Mithat has joined the channel

Mona Ghassemi
2020-04-30 09:30:17

@Mona Ghassemi has joined the channel

Soumyadeep Pal
2020-05-05 00:28:36

@Soumyadeep Pal has joined the channel

gustavo
2020-05-06 22:06:09

@gustavo has joined the channel

Ababacar Diaw
2020-05-08 02:37:02

@Ababacar Diaw has joined the channel

MaG
2020-05-09 05:57:56

@MaG has joined the channel

Kranthi Kiran Arveti
2020-05-13 15:40:08

@Kranthi Kiran Arveti has joined the channel

Kranthi Kiran Arveti
2020-05-13 15:50:24

@here, I have a question specific to cucumber scenario outline. Is there a way to generate dynamic values under scenario outline examples? I'm using javascript as the implementation language in my project.

For example, in below table I need to generate today's date dynamically instead of hardcoding the date.

Examples: | locationId | date | | 12345 | today |

Thanks in advance.

Marco Sanabria
2020-05-13 15:56:30

*Thread Reply:* Not directly in the .feature file, but you can accomplish that in the steps files, which are js files

Kranthi Kiran Arveti
2020-05-13 15:59:54

*Thread Reply:* Thanks Marco.. can you share any references to follow?

Marco Sanabria
2020-05-13 16:09:06

*Thread Reply:*

Marco Sanabria
2020-05-13 16:09:40

*Thread Reply:* I don’t have a reference in itself, but that’s an idea that could help ☝️

Kranthi Kiran Arveti
2020-05-13 16:16:18

*Thread Reply:* This helps.. I'll try this way.. Thanks Marco..

👍 Marco Sanabria
Zoe Buck
2020-05-14 09:59:09

@Zoe Buck has joined the channel

Blue Thunder Somogyi
2020-05-15 12:30:38

@Blue Thunder Somogyi has joined the channel

Karthik
2020-05-19 00:40:31

@Karthik has joined the channel

José Hurtado
2020-05-19 02:25:01

@José Hurtado has joined the channel

Mark Trostler
2020-05-19 09:58:17

@Mark Trostler has joined the channel

sonja leaf
2020-05-22 09:36:44

@sonja leaf has joined the channel

Stephen Nelson-Smith
2020-05-22 09:50:48

@Stephen Nelson-Smith has joined the channel

Stephen Nelson-Smith
2020-05-22 11:05:32

I may be missing a point somewhere, but I’m looking at the picklejs docs, and this seems to be entirely missing the point - there’s a load of grammar about interacting with elements etc, but this seems to be to be blurring behaviour and implementation; My scenarios should be specifying how the app behaves in ubiquitous language for the problem domain, not describing what I am clicking on.

Stephen Nelson-Smith
2020-05-22 11:06:49

I can use Cypress (or something else) to do the actual clicking and exploring, in steps… it seems like an abstraction too far to be using Gherkin to describe interaction with the DOM

Stephen Nelson-Smith
2020-05-22 11:07:05

I’d like to write something like this:

Stephen Nelson-Smith
2020-05-22 11:09:54

```Background: Given I have created a new shop And I have entered the shop customizer

Scenario: Default Colors

When I check to see what I can customize Then I see that color is an option

When I select the color customizer Then I will see options to customize the primary, secondary, and background settings

When I check the default settings for primary colors Then I will see that the components are blue And the text color is white

When I select the primary color customizer And I set the components color to red And the text color to black Then the text on the language bar should be black And the bar should be red```

Stephen Nelson-Smith
2020-05-22 11:10:22

and then do the actual steps using cypress or puppeteer or something

💯 sonja leaf
Stephen Nelson-Smith
2020-05-22 11:10:31

this seems to be in line with BDD principles

Stephen Nelson-Smith
2020-05-22 11:10:38

Am I missing something?

David Goss
2020-05-22 12:31:42

No I think you’re exactly right - you should be able to rebuild your UI - different framework, different details/components - and just have to update some step code, not change any gherkin.

I’ve gone as far as to add lint rules to prevent words like “click” and “screen” being used in step text.

(If it works for some folks that’s all good...but yeah not really BDD)

Stephen Nelson-Smith
2020-05-22 14:57:54

Thanks! I guess my objection to this is two-fold; firstly on general BDD principles, but secondly because it gives Gherkin/Cucumber a bad name, because it really is just overhead - there’s no benefit to trying to write the actual mechanisms of element/ui interaction, or object instantiation in Gherkin - in fact it’s counter-productive - there are better tools with more powerful paradigms available, which you’re going to have to use anyway in your step definitions in most cases; so you did neither one thing (express the behaviour in the language of the domain, common to users and stakeholders) nor did you actually write code that does the actual testing - you just did a middle ground abstraction layer. If people think / see / believe that’s what Gherkin is for, I can well understand why people generate resistance. That’s why I always insist that Gherkin/Cucumber is about the “C”s - conversation, collabaoration, concerete examples, and counter-examples.

👍 David Goss
Stephen Nelson-Smith
2020-05-22 14:58:01

Rant over!

Stephen Nelson-Smith
2020-05-23 09:46:46

This might be a bit of an IDE-specific question, but we can try… I’m using IntelliJ IDEA (Ultimate) as my IDE, but writing Javascript tests… when the IDE offers to generate a step for me, it’s trying to do it using Java. Does anyone have any idea how to encourage it to do that in Javascript? No big deal to do it manually, but if there’s a way to do it, it’d be cool.

David Goss
2020-05-23 10:56:26

I think by default IntelliJ has plugins activated for cucumber JVM which help you with Java or Scala - you can also activate the (still first party) cucumber js plugin and then it’ll recognise steps in JavaScript or TypeScript

Stephen Nelson-Smith
2020-05-23 11:02:00

Ah right yep that did the trick

Stephen Nelson-Smith
2020-05-23 11:02:02

Thanks!

Stephen Nelson-Smith
2020-05-23 13:27:25

So I have a general question… I’m absolutely not a front-end dev - I’m not confident with DOM concepts, and have only ever been a backend person - I’ve mostly written APIs and CLIs — with that context: a friend of mine has written the beginning of a simple turn-based card game - the game begins with two hand of cards dealt and some on the table. I know the rules of the game, and thought it’d be fun to try to write tests for them. Of course because the game is already written, I’m having to test the implementation… but I wonder if one were writing this test first, what would one’s thinking be like? The behaviour I want is to see 6 cards face down (belonging to the computer), 6 cards face up (belonging to the human), and 4 cards face up (the starting point of the game). That’s easy to express in Gherkin, but the steps would force me to think about how to present these as elements / components, I guess? I find it very interesting to think about, but as a person without expertise in this domain, I’m genuinely curious to know how a person would do that.

Cat
2020-05-26 10:42:54

*Thread Reply:* Nifty thing: I have a similar background - I started in backend and services and only started working in JS at all about 3.5 years ago 🙂 Would it be helpful to look at boilerplate projects like this one? Obviously this is highly abstracted for generic browser testing use (and this uses the webdriverio running with cucumber config’d, rather than cucumber runner wrapping wdio as its browser driver), but might help you see how it would be implemented: https://github.com/webdriverio/cucumber-boilerplate

Website
<p><a href="http://webdriver.io">http://webdriver.io</a></p>
Stars
<p>378</p>
Olivier Dennemont
2020-05-25 00:31:00

@Olivier Dennemont has joined the channel

Js.Pete
2020-05-25 10:07:43

@Js.Pete has joined the channel

Andri Ramdan
2020-05-25 18:00:28

@Andri Ramdan has joined the channel

Daria X
2020-05-26 19:33:17

@Daria X has joined the channel

Akash
2020-05-27 20:58:29

@Akash has joined the channel

Rostyslav Voitovych
2020-06-04 05:30:31

@Rostyslav Voitovych has joined the channel

Rostyslav Voitovych
2020-06-04 05:33:26

Hi there. I have a question how to configure Cucumber to output test results as messages in an ndjson file. I have seen this repository https://github.com/cucumber/cucumber/tree/master/messages but got no answer

Sachin Salim
2020-06-05 04:06:37

@Sachin Salim has joined the channel

Adam
2020-06-05 06:59:24

@Adam has joined the channel

LayMui
2020-06-05 15:22:51

@LayMui has joined the channel

LayMui
2020-06-05 15:25:15

n the feature file: I used datatable like this: Background:     Given James is at the portal page     And he login to the portal       |name|role|       |james|global admin| , what is the syntax like in Typescript/JS in the step definitions? how do I pass in the parameter to call a function Login.of() to pass in the parameter from the table? here my step definitions: and(/(?:he|she|they) login to the portal/, () => actorInTheSpotlight().attemptsTo(Login.of(name,role)), ));

sonja leaf
2020-06-05 16:08:00

*Thread Reply:* Hi @LayMui I responded in the main #help channel, but I think this might help: https://cucumberbdd.slack.com/archives/C60TKS3SL/p1591394971489400

sonja leaf (https://cucumberbdd.slack.com/team/U013PRRMKKR)
sonja leaf
2020-06-05 16:08:54

*Thread Reply:* I would then access the contents of the dataTable as dataTable.name and dataTable.role.

👍 LayMui
LayMui
2020-06-05 16:14:41

*Thread Reply:* I think my issue is the syntax for Typescript: here is my code snippet: and(/(?:he|she|they) login to the portal/, (table) { const input = table.hashes(); const name = input[0].name;const role = input[0].role; and I got this compilation error: [test:execute] Property 'answeredBy' is missing in type 'RegExp' but required in type 'Expectation<any, unknown>'.

sonja leaf
2020-06-05 16:18:31

*Thread Reply:* TypeScript is not my specialty. There may be others more familiar with TypeScript that can explain what’s gong on here. I’m not sure which line is throwing the RegExp/Expectation error you’re seeing.

Sachin Salim
2020-06-08 04:47:20

I was trying a basic url launch in wdio cucumber, ReferenceError: browser is not defined is the displayed error

Cat
2020-06-08 06:16:46

*Thread Reply:* Pass the browser you want in the config

Sachin Salim
2020-06-08 06:20:13

*Thread Reply:* browserName: 'chrome', its there I guess

Cat
2020-06-08 06:24:24

*Thread Reply:* You should probably check the webdriverio gitter channel - the CLI for wdio isn’t the same as that for cucumberjs

Sachin Salim
2020-06-08 06:25:02

*Thread Reply:* let me check

mlvandijk
2020-06-09 04:12:02

@mlvandijk has left the channel

Priya Doolapeta
2020-06-09 05:35:10

@Priya Doolapeta has joined the channel

SJrX
2020-06-11 18:27:13

@SJrX has joined the channel

SJrX
2020-06-11 18:32:00

I'm testing an API with Cucumber, where the user supplies a URL as input, and then the back end server fetches it and does something with it (In particular it is an OpenID Connect Discovery Document). The issue I have is that in our feature files I'm not sure what URL to put in, since it is an environment setting and comes from that, so it depends on the machine. Right now I am doing something like "[WIREMOCK_URL]" in the feature file but then in every step definition involved I have to do a string subtitution, which is annoying.

Is there some built in way to have feature file reference externally defined variables, or some other solution to this problem.

SJrX
2020-06-12 08:02:23

Does CucumberJS by chance have a hook I can use to preprocess the feature files?

Sachin More
2020-06-25 12:59:56

*Thread Reply:* yes, this should help you…https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md

Sachin Salim
2020-06-14 07:39:58

Error: Unexpected token 'export' I'm unable to run because of the export error

Sachin Salim
2020-06-14 07:40:11

in wdio cucumber framework

Wilfred Roshan Lobo
2020-06-16 07:58:11

@Wilfred Roshan Lobo has joined the channel

Tanatip Sukkum
2020-06-19 03:30:22

@Tanatip Sukkum has joined the channel

ExploreWorld
2020-06-24 14:15:15

@ExploreWorld has joined the channel

ec-mark
2020-06-25 18:07:37

Hi all, is there any way using the cucumber cli (or otherwise) to scan a directory containing step definition files and output them somewhere? I’m basically looking for a way to provide a list of step definitions that have been implemented in my platform programmatically

Aslak Hellesøy
2020-06-26 01:02:01

@ec-mark this will be possible when https://github.com/cucumber/cucumber-js/issues/1369 is fixed. Use --format message:cucumber.ndjson . You'll then find the step definitions in cucumber.ndjson . More info here:

https://github.com/cucumber/cucumber/tree/master/messages https://github.com/cucumber/cucumber/blob/master/messages/messages.md#io.cucumber.messages.StepDefinition

ec-mark
2020-06-26 06:15:57

*Thread Reply:* That's great, thank you! I will track this and try it out when ready

Mark
2020-06-27 14:12:37

@Mark has joined the channel

Matias Alfonso
2020-06-30 02:31:37

@Matias Alfonso has joined the channel

Matias Alfonso
2020-06-30 02:32:29

Hi everyone. I would like to know if is there a way to log in on the console the steps in real-time, I mean the step description when it is running. I'm working with CucumberJS. Thanks!

luke
2020-06-30 02:44:35

so you want to debug in process?

I would advise either using a debug package (npm I think for you), or I cheat and use RubyMine (part of intellij family), I think your equivalent would be webstorm?

Matias Alfonso
2020-06-30 03:04:05

I just want to see where a Step start because in that way I can see the information that I'm showing is running inside that Step

Matias Alfonso
2020-06-30 03:04:18

Protractor works in that way

Matias Alfonso
2020-06-30 03:04:28

But I don't want to use Protractor

luke
2020-06-30 03:11:12

so the starts are linear. Step 2 starts after step1.

Matias Alfonso
2020-06-30 03:27:34

I know that. But you don't know when a Step has started

Matias Alfonso
2020-06-30 03:28:44

and the option @BeforeStep is not longer available

Matias Alfonso
2020-06-30 03:29:28

because with that option, you can put something like console.log(step) and is a way to fix it

luke
2020-06-30 03:40:27

hang on i'm confused. You know when a step is running because you will be in the step def code?

luke
2020-06-30 03:40:28

If you debug.

luke
2020-06-30 03:40:47

If I'm misunderstanding then apologies.

Matias Alfonso
2020-06-30 03:44:15

I don't want to debug

Matias Alfonso
2020-06-30 03:44:50

just identify what piece of code is running in the real time

luke
2020-06-30 03:52:17

Right, so dump the line of code at any time>?

luke
2020-06-30 03:52:32

So you could use an afterstep and then state the scenario step at each time?

luke
2020-06-30 03:54:59

ah hang on. JS doesn't support before/aftersteps.

luke
2020-06-30 03:55:02

sorry 😞

Matias Alfonso
2020-06-30 04:23:26

I have found the workaround. Using cucumber-pretty

luke
2020-06-30 05:56:40

I'm still not 100% sure what the issue was, but if you're sorted then well done for doing it.

Francisco Rodriguez
2020-07-01 12:09:33

@Francisco Rodriguez has joined the channel

Abdulaziz
2020-07-02 12:34:28

@Abdulaziz has joined the channel

Abdulaziz
2020-07-02 12:34:43

Hello everyone, I hope you are all well and safe

Abdulaziz
2020-07-02 12:36:43

I am relatively new to cucumber. I have set up my own project but I would like to create a page which I can import so it will be used to control opening the browser

Abdulaziz
2020-07-02 12:37:36

right now, I would have to add this on everypage because if this is missing I will get an error saying findElement is undefined ``` driver = new webdriver.Builder() .withCapabilities(webdriver.Capabilities.chrome()).build();

}```
Aslak Hellesøy
2020-07-02 14:53:45

*Thread Reply:* Hi @Abdulaziz - have you considered asking the Selenium/WebDriver community about this? I don't see how this is related to Cucumber.

Abdulaziz
2020-07-03 02:44:35

*Thread Reply:* @Aslak Hellesøy Thanks sure will do.

Richard
2020-07-16 17:05:22

*Thread Reply:* One option could be store your driver instance in a variable , then have a method to get that instance - getWebdriverInstance() . As Aslak said not a cucumber question

Refia
2020-07-04 19:22:04

@Refia has joined the channel

Reyjie Mesias
2020-07-06 07:26:23

@Reyjie Mesias has joined the channel

cLAU
2020-07-06 11:59:49

@cLAU has joined the channel

Dan Mackay
2020-07-07 05:37:50

@Dan Mackay has joined the channel

cLAU
2020-07-08 12:02:24

hello!! i have a question, i want to use same step definition for 2 identical features files with differente tag, is possible to match step definitions files with feature through the tag that i created????

Aslak Hellesøy
2020-07-08 15:26:44

*Thread Reply:* @cLAU yes

Mary Joy Magbanua
2020-07-15 07:08:20

@Mary Joy Magbanua has joined the channel

Anthony Denneulin
2020-07-16 00:38:59

@Anthony Denneulin has joined the channel

Richard
2020-07-16 17:10:27

Hi, Anyone have any articles or know how to in cucumber.js get the test name into a step definition ? I tried export const getTestName = scenario.pickle.name and then calling this in my step devs via import but the export throws an error. So question is how can I pass test name into my step defs?

sonja leaf
2020-07-17 14:54:12

*Thread Reply:* Hello @Richard - I do this to populate a value before each step: ```const { Before } = require('cucumber');

Before(async function (scenario) { this.testname = scenario.pickle.name;

// if we need to grab a screenshot this.shortname = scenario.pickle.name .toLowerCase() .split(' ') .join('-');

});```

Richard
2020-10-04 12:55:01

*Thread Reply:* Thanks @sonja leaf bit late 🤦‍♂️:skintone5:. Didn’t see this till now

plocket
2020-11-17 14:21:01

*Thread Reply:* It helped me, though!

👍 sonja leaf
Gunjan Singh
2020-07-21 04:15:17

@Gunjan Singh has joined the channel

Gunjan Singh
2020-07-21 04:17:10

Hi .. is there any good course or document for cucumber + webdriver + react .. I am trying to test a button click event

Vignesh G
2020-07-21 20:34:51

@Vignesh G has joined the channel

preethi
2020-07-22 02:39:54

@preethi has joined the channel

Joseph Rios
2020-07-22 14:23:43

@Joseph Rios has joined the channel

Barnaby Golden
2020-07-24 02:16:01

@Barnaby Golden has joined the channel

LayMui
2020-07-28 00:10:48

is there any example to use after hook in cucumber?

Cat
2020-07-28 05:52:20

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md

Jo Laing
2020-07-28 04:15:32

@Jo Laing has joined the channel

Damonpam
2020-07-28 05:05:08

@Damonpam has joined the channel

preethi
2020-07-31 07:25:16

Hi Everyone Has anyone got an example cypress - cucumber style project structure?

Sachin More
2020-07-31 10:47:16

*Thread Reply:* you can check this out… https://github.com/davidjgoss/cucumber-puppeteer-typescript-starter

Language
<p>TypeScript</p>
Last updated
<p>12 days ago</p>
👍 preethi
🙏 preethi
Andreas Markussen
2020-08-03 01:01:25

*Thread Reply:* be aware of the cucumber cypress option about global step definitions being turned off by default

👍 preethi
SMHA
2020-08-01 02:18:45

@SMHA has joined the channel

Marcos Bellucci
2020-08-03 05:54:04

@Marcos Bellucci has joined the channel

Tejas Deshpande
2020-08-04 22:21:20

@Tejas Deshpande has joined the channel

Natasha Whitter
2020-08-06 02:37:23

@Natasha Whitter has joined the channel

Neil Yang
2020-08-07 13:12:33

@Neil Yang has joined the channel

MMagdy
2020-08-11 05:30:15

@MMagdy has joined the channel

MMagdy
2020-08-11 05:30:18

hi all in javascript, how to pass object and array of objects over step ?

seb
2020-08-11 12:46:03

*Thread Reply:* Please give us more details of what you are trying to achieve.

MMagdy
2020-08-11 13:29:01

*Thread Reply:* I have function that take array of objects and reformat its content

MMagdy
2020-08-11 14:59:04

*Thread Reply:* @seb I solved it for object, use rowsHash function to get object structure from data table in step for array, use hashes function to get array of objects from data table in step

:dancing_pickle: Jo Laing
NarayanaswamyCNS
2020-08-11 05:54:20

@NarayanaswamyCNS has joined the channel

vishu handa
2020-08-11 07:47:27

@vishu handa has joined the channel

Lourdes Peña
2020-08-13 05:53:50

@Lourdes Peña has joined the channel

Derick
2020-08-18 14:10:15

@Derick has joined the channel

Utahcon
2020-08-20 12:07:17

@Utahcon has joined the channel

Utahcon
2020-08-20 12:08:25

I am following the tutorial for cucumber-js but when I do npm i -D cucumber in my fresh directory no node_modules dir is created. I have tried other packages, and they work fine, but not the cucumber ones. Any ideas?

Utahcon
2020-08-20 12:11:30

*Thread Reply:* ```$ mkdir shouty [utahcon@beast utahcon]$ cd shouty/ [utahcon@beast shouty]$ ls -al total 8 drwxrwxr-x. 2 utahcon utahcon 4096 Aug 20 13:08 . drwxrwxr-x. 27 utahcon utahcon 4096 Aug 20 13:08 .. [utahcon@beast shouty]$ npm init -y Wrote to /home/utahcon/Projects/src/github.com/utahcon/shouty/package.json:

{ "name": "shouty", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC" }

$ npm install -D cucumber npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN shouty@1.0.0 No description npm WARN shouty@1.0.0 No repository field.

audited 77 packages in 2.507s found 0 vulnerabilities

$ npm --versbose install -D cucumber npm WARN shouty@1.0.0 No description npm WARN shouty@1.0.0 No repository field.

audited 77 packages in 2.196s found 0 vulnerabilities

$ npm --verbose install -D cucumber npm info it worked if it ends with ok npm verb cli [ npm verb cli '/usr/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli '--verbose', npm verb cli 'install', npm verb cli '-D', npm verb cli 'cucumber' npm verb cli ] npm info using npm@6.14.8 npm info using node@v12.18.3 npm verb npm-session 1cae8be88e4a4053 npm http fetch GET 304 https://registry.npmjs.org/cucumber 190ms (from cache) npm timing stage:loadCurrentTree Completed in 260ms npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms npm timing stage:loadIdealTree:loadShrinkwrap Completed in 97ms npm http fetch GET 304 https://registry.npmjs.org/assertion-error-formatter 76ms (from cache) npm http fetch GET 200 https://registry.npm ... npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 1701ms npm timing stage:loadIdealTree Completed in 1835ms npm timing stage:generateActionsToTake Completed in 15ms npm verb correctMkdir /home/utahcon/.npm/locks correctMkdir not in flight; initializing npm verb lock using /home/utahcon/.npm/locks/staging-5cbe75a208033ad6.lock for /home/utahcon/Projects/src/github.com/utahcon/shouty/nodemodules/.staging npm verb unlock done using /home/utahcon/.npm/locks/staging-5cbe75a208033ad6.lock for /home/utahcon/Projects/src/github.com/utahcon/shouty/node_modules/.staging npm timing stage:executeActions Completed in 15ms npm timing stage:rollbackFailedOptional Completed in 1ms npm timing stage:runTopLevelLifecycles Completed in 2179ms npm verb saving [ { name: 'cucumber', spec: '^6.0.5', save: 'devDependencies' } ] npm verb shrinkwrap skipping write for package.json because there were no changes. npm info lifecycle undefined~preshrinkwrap: undefined npm info lifecycle shouty@1.0.0~shrinkwrap: shouty@1.0.0 npm verb shrinkwrap skipping write for package-lock.json because there were no changes. npm info lifecycle shouty@1.0.0~postshrinkwrap: shouty@1.0.0 npm WARN shouty@1.0.0 No description npm WARN shouty@1.0.0 No repository field.

npm timing audit submit Completed in 228ms npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 229ms npm timing audit body Completed in 1ms audited 77 packages in 2.398s found 0 vulnerabilities

npm verb exit [ 0, true ] npm timing npm Completed in 2999ms npm info ok

$ ls -al total 36 drwxrwxr-x. 2 utahcon utahcon 4096 Aug 20 13:09 . drwxrwxr-x. 27 utahcon utahcon 4096 Aug 20 13:08 .. -rw-rw-r--. 1 utahcon utahcon 273 Aug 20 13:09 package.json -rw-rw-r--. 1 utahcon utahcon 23232 Aug 20 13:09 package-lock.json```

Aslak Hellesøy
2020-08-20 13:41:07

*Thread Reply:* I have no idea @Utahcon - it sounds like it's related to your node and/or npm installation. I've followed the same steps as you and ls -al node_modules | wc -l reports 79 for me.

Jacob Wicks
2020-08-21 15:35:03

@Jacob Wicks has joined the channel

Jacob Wicks
2020-08-21 15:38:34

Hello, I am trying to call cucumber programatically from inside a node.js function.

I have gotten as far as const reqd = require('cucumber');   const cliArgs = {     path: "./features/mySecond.feature"   };

  let cli = new reqd.Cli(cliArgs);   await cli.run();

But I cannot figure out how to properly format the arguments to pass into cli.run. If anyone can share an example, point me to documentation, or a github issues thread that would be awesome. the cliArgs object that I have is not correct.

I have read https://github.com/cucumber/cucumber-js/issues/786 and looked at the source code here: https://github.com/cucumber/cucumber-js/blob/master/src/cli/index.ts and here: https://github.com/cucumber/cucumber-js/blob/master/src/cli/run.ts

Jacob Wicks
2020-08-21 16:41:54

Ok, I figured out a set of arguments that works to at least get it running:

const cucumber = require('cucumber');

  const stream = require('stream');   const outputStream = new stream.Writable();

  outputStream._write = async function (chunk, encoding, done) {        context.log(chunk.toString());        done();  };

  const runArgs = ['node', 'cucumber_js'];   const cli = new cucumber.Cli({argv: runArgs, cwd: process.cwd(), stdout: outputStream});   cli.run();

Wojciech Mucha
2020-08-24 00:59:41

@Wojciech Mucha has joined the channel

Wojciech Mucha
2020-08-24 01:07:33

Hi! Is there a way to change the attachment name in cucumber-js?

David Goss
2020-08-28 13:40:08

*Thread Reply:* There isn’t - attachments have no naming, it’s just their content and their media type

Matthew Brent
2020-08-24 05:25:28

@Matthew Brent has joined the channel

ancaramel
2020-08-24 15:18:02

@ancaramel has joined the channel

Jacob Wicks
2020-08-26 14:52:37

I am trying to figure out how to pass feature files to cucumber as strings.

I have the same use case as @chamberlainpi , who asked here: https://github.com/cucumber/cucumber-js/issues/1308

> [Is there] any way to use [cucumber js] as a node module, like importing/requiring the cucumber library and running tests by passing the features as an array of strings, instead of pointing to a folder of features files. > Something along the lines like: ```const cucumber = require('cucumber'); const featuresArr = loadFeaturesStrings('http://some.where.com/');

const results = await cucumber.run({ features: featuresArr, steps: require('./steps.js') });``` That is exactly what I want to do. I want to give my users a GUI that will let them create features. Then I want to take the features that they have created and pass them to cucumber as a parameter of an async function. I want to await the execution of cucumber, get the results back, then display the results to my users.

But I have been working on this for days and I cannot figure out what I need to do to make it work.

@Izhaki responded to chamberlainpi's post. Izhaki says

> This is possible, and exactly what is done in the browser example, specifically here: const gherkinMessageStream = Gherkin.fromSources( [ messages.Envelope.fromObject({ source: { data: featureEditor.getValue(), // &lt; getValue() returns a feature as string uri: 'example.feature', }, }), ], { newId } ) I looked at the code in the example that Izhaki linked and I can't figure out how to reproduce it locally.

I see that index.html uses two scripts, cucumber.js and browser-example.js. &lt;script type="text/javascript" src="cucumber.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="browser-example.js"&gt;&lt;/script&gt; I'm having real difficulty making a working file based on the browser example index.ts because it seems like the example code is using a different export than I am getting from the cucumber I have installed in node_modules.

The example code generates gherkinMessageStream, then uses Cucumber.parseGherkinMessageStream to parse it into an array of strings assigned to const pickleIds. const pickleIds = Cucumber.parseGherkinMessageStream({ But I get TypeError: Cucumber.parseGherkinMessageStream is not a function Also, there is no parseGherkinMessageStream exported from the node_module cucumber. I searched the folder and couldn't find anything called parseGherkinMessageStream.

I can see the code for parseGherkinMessageStream in src/cli/helpers.ts on github. But I have not been able to access it using cucumber from my node_modules folder.

If I comment out the use of parseGherkinMessageStream and just assign an empty array to pickleIds, const pickleIds: string[] = []; cucumber does run and outputs

0 scenarios 0 steps 0m00.000s So I feel like I am close. But I am completely stumped at this point. I have read the docs and everything I could find on the internet & stackoverflow.

Here's my whole index.ts file. How can I get this working?

Jacob Wicks
2020-08-26 14:52:37

```import { EventEmitter } from 'events'; import Gherkin from 'gherkin'; import { messages, IdGenerator } from 'cucumber-messages'; const Cucumber = require('cucumber');

const featureString = `Feature: Simple maths In order to do maths As a developer I want to increment variables

Scenario: easy maths Given a variable set to 1 When I increment the variable by 1 Then the variable should contain 2

Scenario Outline: much more complex stuff Given a variable set to <var> When I increment the variable by <increment> Then the variable should contain <result>

Examples: | var | increment | result | | 100 | 5 | 105 | | 99 | 1234 | 1333 | | 12 | 5 | 18 |`;

const { uuid } = IdGenerator;

async function runFeature(): Promise<boolean> { const eventBroadcaster = new EventEmitter();

const eventDataCollector = new Cucumber.formatterHelpers.EventDataCollector(
    eventBroadcaster
);

const newId = uuid();
const gherkinMessageStream = await Gherkin.fromSources(
    [
        messages.Envelope.fromObject({
            source: {
                data: featureString,
                uri: 'example.feature',
            },
        }),
    ],
    { newId }
);

const pickleIds = Cucumber.parseGherkinMessageStream({
    cwd: '',
    eventBroadcaster,
    eventDataCollector,
    gherkinMessageStream,
    pickleFilter: new Cucumber.PickleFilter({ cwd: '' }),
    order: 'defined',
});

Cucumber.supportCodeLibraryBuilder.reset('', newId);

const supportCodeLibrary = await Cucumber.supportCodeLibraryBuilder.finalize();

const formatterOptions = {
    cwd: '/',
    eventBroadcaster,
    eventDataCollector,
    parsedArgvOptions: {
        colorsEnabled: true,
    },
    log(data: string) {
        console.log(data);
    },
    supportCodeLibrary,
};
Cucumber.FormatterBuilder.build('progress', formatterOptions);

const runtime = new Cucumber.Runtime({
    eventBroadcaster,
    eventDataCollector,
    newId,
    options: {},
    pickleIds,
    supportCodeLibrary,
});

return runtime.start();

}

runFeature();```

David Goss
2020-08-28 13:48:30

*Thread Reply:* Hi, I haven’t studied your example in detail, but we have recently added a programmatic usage of the cli to the project here https://github.com/cucumber/cucumber-js/blob/master/compatibility/cck_spec.ts - lots of that code is related to the testing/assertions it’s doing but hopefully it helps

ec-mark
2020-08-28 10:57:00

Hi folks, is it possible to access the world (a custom world in my case) from an After(...) hook?

ec-mark
2020-08-28 11:06:25

*Thread Reply:* Also, not directly related, but is normal for a world to be constructed multiple times for one scenario?

Using cucumberjs 6.0.5 by the way

David Goss
2020-08-28 13:37:30

*Thread Reply:* Yes you can access the World from an After hook (but not AfterAll). It’ll be the value of ‘this’ (make sure you don’t use an arrow function)

David Goss
2020-08-28 13:38:33

*Thread Reply:* You should expect one stance of World to be created for every scenario that runs (for a scenario outline, that’s one per example)

ec-mark
2020-08-28 13:45:16

*Thread Reply:* yes, I found that, thanks 🙂

I did not dig into it, but I put a logging line in my custom world's constructor, and I saw 3 instances of it created

my feature only specifies 1 scenario (no outline being used)

ec-mark
2020-08-28 13:46:01

*Thread Reply:* didn't harm anything for me, so I moved on. After(...) is only executed once

David Goss
2020-08-28 13:46:44

*Thread Reply:* Okay, are you able to put an example up somewhere we can reproduce that?

Also just a thought, are you using the retry feature?

ec-mark
2020-08-28 13:51:43

*Thread Reply:* not using the retry feature. I can probably get an example up sometime next week 🙂 too late in the day on a Friday

David Goss
2020-08-28 14:21:34

*Thread Reply:* No problem :)

Jesse Kahner
2020-08-31 11:29:52

@Jesse Kahner has joined the channel

Mona Ghassemi
2020-09-01 14:03:32

Hello. So I learned a bit of cucumber a while ago but I'm a bit rusty. Today I wanted to implement a series of very similar scenarios with a change in string. So after some digging I found how to set up a scenario outline and table (sadly, the correct syntax appears not to be available in the main documentation). Anyway, now I have only added one case and got my scenario to run to completion (all the steps to pass are running). However, the scenario fails with the following error. Simply googling this error doesn't appear to give any useful results. Any tips?

[0-0] 2020-09-01T20:56:06.597Z ERROR @wdio/runner: TypeError: Cannot read property 'indexOf' of undefined
    at /...../git/test-project/node_modules/@wdio/cucumber-framework/build/utils.js:85:20
    at Array.forEach (&lt;anonymous&gt;)
    at /...../git/test-project/node_modules/@wdio/cucumber-framework/build/utils.js:84:35
    at Array.forEach (&lt;anonymous&gt;)
    at getUniqueIdentifier (/...../git/test-project/node_modules/@wdio/cucumber-framework/build/utils.js:83:23)
    at CucumberReporter.handleAfterScenario (/...../git/test-project/node_modules/@wdio/cucumber-framework/build/reporter.js:175:43)
    at CucumberEventListener.emit (events.js:310:20)
    at CucumberEventListener.EventEmitter.emit (domain.js:482:12)
    at CucumberEventListener.onTestCaseFinished (/...../git/test-project/node_modules/@wdio/cucumber-framework/build/cucumberEventListener.js:135:10)
    at EventEmitter.emit (events.js:310:20)
    at EventEmitter.emit (domain.js:482:12)
    at TestCaseRunner.emit (/...../git/test-project/node_modules/cucumber/lib/runtime/test_case_runner.js:92:27)
    at TestCaseRunner.run (/...../git/test-project/node_modules/cucumber/lib/runtime/test_case_runner.js:227:12)
    at async Runtime.runTestCase (/...../git/test-project/node_modules/cucumber/lib/runtime/index.js:76:28)
[0-0]  Error:  Cannot read property 'indexOf' of undefined
[0-0] 2020-09-01T20:56:06.598Z INFO webdriver: COMMAND deleteSession()
2020-09-01T20:56:06.598Z INFO webdriver: [DELETE] <http://localhost:4444/wd/hub/session/42febe7e-5152-8849-839c-5d37dc4ac9fb>
[0-0] FAILED in firefox - /src/featureFiles/CustomerWebPortal/Booking/square.featur
Mona Ghassemi
2020-09-01 14:07:19

*Thread Reply:* Looks like it is a js equivalent of "array index out of bounds"? https://stackoverflow.com/questions/24911859/cannot-read-property-indexof-of-undefined

Stack Overflow
Mona Ghassemi
2020-09-01 14:09:08

*Thread Reply:* "@wdio/cucumber-framework": "^6.1.18", version

Mona Ghassemi
2020-09-01 14:09:16

*Thread Reply:* "cucumber": "^6.0.5",

Mona Ghassemi
2020-09-01 14:13:18

*Thread Reply:* This is my scenario outline: ```Scenario Outline: When I make a booking with <card> card Then the booking is created

Examples: | card | | Visa | ```

Mona Ghassemi
2020-09-02 06:19:35

*Thread Reply:* I made a PR to the wdio repo that fixes this but I am surprised it doesn't appear anyone else has run into it.

Film
2020-09-02 23:49:22

@Film has joined the channel

Des Horsley
2020-09-03 14:58:49

Hello, I've been having a lot of trouble with random build failures. Running cucumber and protractor on a local angular app in cicd. Same code base, it will pass a hand full of times, then randomly, 76/85 tests will fail and many of the failed tests (Not all of them) will have this in the logs: NoSuchSessionError: invalid session id Its like one of the tests fails, and that seems to brick selenium or something

Des Horsley
2020-09-03 14:58:59

Anyone seen this sort of behaviour before?

Des Horsley
2020-09-07 20:39:54

*Thread Reply:* For anyone mildy interested, I think what happened is on a resource poor system, when a couple of the tests failed because of a timeout, either selenium or protractor crashed, which fails the rest of the tests.

Kārlis Amoliņš
2020-10-08 16:21:32

*Thread Reply:* I know you posted this a long time ago, but the times I have seen that, it usually indicates some sort of race condition. Let's say, you forgot an await on something, and 95% of the time it executes just in time, but on those 5% of times it doesn't and browser session is killed, it will throw that.

Des Horsley
2020-10-08 16:22:25

*Thread Reply:* Thanks @Kārlis Amoliņš I upgraded typescript and tslint to the latest and made use of the new newer lint rules to find the missing awaits, looks like its stable now. Cheers

Kārlis Amoliņš
2020-10-08 16:39:26

*Thread Reply:* Glad to hear! Cheers!

Vijayaragavan G
2020-09-04 21:51:28

@Vijayaragavan G has joined the channel

Wojciech Mucha
2020-09-09 00:42:11

Hi! Did someone know a workaround to allow BeforeAll hook have access to World instance? I have a case where I want to attach some info to the test report about testing environment and I want to use this.attach() method.

David Goss
2020-09-09 01:48:25

Hi, BeforeAll hooks don’t have access to a world because a world belongs to a scenario, and BeforeAll happens before any scenarios. There is some discussion on this issue https://github.com/cucumber/cucumber-js/issues/1393 including a possible way forward

alexkaufman06 (https://github.com/alexkaufman06)
Comments
6
Wojciech Mucha
2020-09-09 08:35:56

*Thread Reply:* Yes, I know. I read this discussion. Hovewere I was thinking how to make this possible. I was trying with call() method to share contex from customWorld but without luck.

luke
2020-09-09 01:54:30

Interesting @David Goss I raised this as an issue a couple of months ago in cucumber-ruby. Good explanation, kinda think we should rethink it generally.

luke
2020-09-09 01:55:57

One idea, but no idea how. Is to make the BeforeAll world sort of "more stateful", and have the variables set there auto-created for each run. A bit like it would happen in rspec for example.

Barnita Gupta
2020-09-09 06:54:48

@Barnita Gupta has joined the channel

Barnita Gupta
2020-09-09 06:58:50

Hi All, I'm trying to implement protractor-cucumber-framework from scratch. I got my file working as well. now as a next step I'm trying to implement POM for the same script, but first i need to make my script work without asynchronous call back.I tried to implement synchronously but its throwing error . I do not wish to implement POM with asynchronous callback .Can someone please point me to right direction, or tell me where I'm going wrong with my current code. The application I'm testing is angular only so the error message is not helpful.

*The first step file that is working fine with callback, it stops working if i remove the callback, Error is shown below*

*Feature file* *example data is dummy*

```Feature: Automation Testing for the login module of Asterisk sc solution

Scenario Outline: Scenario Outline name: Login and Verify user
    Given User is redirected to &lt;site&gt;
    When User inputs &lt;username&gt; and &lt;password&gt;
    Then User should be successfully logged in with their &lt;name&gt;

    Examples:
        | site              | username | password       | name     |
        | <http://dummydata/> | xyz      | password12     | dummy    |```

*StepDefinition file*:

```const { Given, When, Then } = require("cucumber"); var chai = require('chai'); var chaiAsPromised = require('chai-as-promised'); const { browser, element } = require("protractor"); chai.use(chaiAsPromised); var expect = chai.expect; var { setDefaultTimeout } = require('cucumber');

setDefaultTimeout(60 ** 1000);

/these are page element locators- needs to be shifted to PO file and reference needs to created here/

var username = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[1]/input')); var password = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[2]/input')); var loginButton = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[3]/button[2]')); var userVerify = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[2]/div[1]')); var logoutButton = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[3]/ul/li/div/a[3]')); var loginHeader = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/p')); var logoutdropdown = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[3]/ul/li')); var teamName = element(by.xpath('/html/body/app-root/app-auth-main/div/div[1]/div/div/div/table/tbody/tr/td[2]/div/div[2]')) var loginError = element(by.xpath('/html/body/div/div/div[1]/h2'))

function login(a, b) { username.sendKeys(a); password.sendKeys(b); loginButton.click();

}

Given(/^User is redirected to (.*)$/, { timeout: 60 * 1000 }, function (site, callback) { browser.get(site); expect(loginHeader.isPresent()).and.notify(callback);

});

When(/^User inputs (.) and (.)$/, { timeout: 60 ** 1000 }, function (username, password, callback) { login(username, password); browser.sleep(2000); browser.getCurrentUrl().then(function (Url) { console.log(Url + " page reached, login successful.") }); expect(userVerify.isPresent()).and.notify(callback); });

Then(/^User should be successfully logged in with their (.*)$/, { timeout: 60 * 1000 }, function (name, callback) {

expect(userVerify.getText()).to.eventually.equal(name); logoutdropdown.click(); logoutButton.click(); browser.sleep(2000); browser.getCurrentUrl().then(function (Url) { console.log("login page " + Url + " reached. Test finished") }); expect(teamName.getText()).to.eventually.equal("Asterisk").and.notify(callback);

});```

*Conf.js* :

```// conf.js exports.config = { directConnect: true, getPageTimeout: 50000, framework: 'custom', frameworkPath: require.resolve('protractor-cucumber-framework'), capabilities:{'browserName': 'chrome'},
specs: ['tests/feature/**.feature'],

cucumberOpts:{ require:'tests/stepdefinition/stepdefinition.js', tags: false, profile: false, 'no-source':true}, onPrepare: function(){ const {Given, Then, When} = require('cucumber'); global.Given = Given; global.When = When; global.Then = Then; browser.manage().window().maximize(); }

}```

*Step file that is failing* ```var chai = require('chai'); var chaiAsPromised = require('chai-as-promised'); const { browser, element } = require("protractor"); chai.use(chaiAsPromised); var expect = chai.expect; var { setDefaultTimeout } = require('cucumber'); setDefaultTimeout(60 ** 1000);

/these are page element locators- needs to be shifted to another file and reference needs to created here/

var username = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[1]/input')); var password = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[2]/input')); var loginButton = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/div[3]/button[2]')); var userVerify = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[2]/div[1]')); var logoutButton = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[3]/ul/li/div/a[3]')); var loginHeader = element(by.xpath('/html/body/app-root/app-auth-main/div/div[2]/app-login/div/div/form/p')); var logoutdropdown = element(by.xpath('/html/body/app-root/app-main/app-header/div/div[2]/div/table/tbody/tr/td[3]/ul/li')); var teamName = element(by.xpath('/html/body/app-root/app-auth-main/div/div[1]/div/div/div/table/tbody/tr/td[2]/div/div[2]')) var loginError = element(by.xpath('/html/body/div/div/div[1]/h2'))

function login(a, b) { username.sendKeys(a); password.sendKeys(b); loginButton.click();

}

Given(/^User is redirected to (.*)$/, { timeout: 60 * 1000 }, function (site) { browser.get(site); expect(loginHeader.isPresent()); });

When(/^User inputs (.) and (.)$/, { timeout: 60 ** 1000 }, function (username, password, callback) { login(username, password); browser.sleep(2000); browser.getCurrentUrl().then(function (Url) { console.log(Url + " page reached, login successful.") }); expect(userVerify.isPresent()).and.notify(callback); });

Then(/^User should be successfully logged in with their (.*)$/, { timeout: 60 * 1000 }, function (name, callback) {

expect(userVerify.getText()).to.eventually.equal(name); logoutdropdown.click(); logoutButton.click(); browser.sleep(2000); browser.getCurrentUrl().then(function (Url) { console.log("login page " + Url + " reached. Test finished") }); expect(teamName.getText()).to.eventually.equal("Asterisk").and.notify(callback);

}); ****error message**** PS C:\Users\dummyUser\Desktop\asteriskTestAutomation> protractor C:\Users\dummyUser\Desktop\asteriskTestAutomation\conf.js [11:13:53] I/launcher - Running 1 instances of WebDriver [11:13:53] I/direct - Using ChromeDriver directly...

DevTools listening on .[11:14:03] E/launcher - Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details" [11:14:03] E/launcher - Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details" at C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\built\browser.js:461:23 at ManagedPromise.invokeCallback (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\nodemodules\seleniumwebdriver\lib\promise.js:1376:14) at TaskQueue.execute (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\nodemodules\seleniumwebdriver\lib\promise.js:3084:14) at TaskQueue.executeNext (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\nodemodules\seleniumwebdriver\lib\promise.js:3067:27) at C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\nodemodules\seleniumwebdriver\lib\promise.js:2927:27 at C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\nodemodules\seleniumwebdriver\lib\promise.js:668:7 at processTicksAndRejections (internal/process/taskqueues.js:97:5)Error at ElementArrayFinder.applyAction_ (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\built\element.js:459:27) at ElementArrayFinder.<computed> [as sendKeys] (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\built\element.js:91:29) at ElementFinder.<computed> [as sendKeys] (C:\Users\dummyUser\AppData\Roaming\npm\nodemodules\protractor\built\element.js:831:22) at login (C:\Users\dummyUser\Desktop\asteriskTestAutomation\tests\stepdefinition\stepdefinition.js:23:12) at World.<anonymous> (C:\Users\dummyUser\Desktop\asteriskTestAutomation\tests\stepdefinition\stepdefinition.js:38:3) [11:14:03] E/launcher - Process exited with error code 199 PS C:\Users\dummyUser\Desktop\asteriskTestAutomation> [30280:26308:0908/111407.969:ERROR:deviceeventlogimpl.cc(208)] [11:14:07.970] Bluetooth: bluetoothadapterwinrt.cc:1074 Getting Default Adapter failed.```

tracey
2020-09-10 02:42:24

@tracey has joined the channel

Aslak Hellesøy
2020-09-14 03:53:46

Is there anyone here using cucumber-js running inside the browser? I'm not talking about running cucumber-js on Node and starting a browser with selenium, I'm talking about actually running cucumber-js inside the browser.

Mona Ghassemi
2020-09-17 07:28:21

Currently we are using "@wdio/cucumber-framework": "^6.1.18", and we are launching all our tests via wdio command. I had tried to use cucumber command but it launched 0 tests. I am interested in the reports feature. Does @cucumber/cucumber play nice with @wdio? In the past on a different project we had used cucumber, and webdriverio dependencies instead.

Aslak Hellesøy
2020-09-17 07:33:53

*Thread Reply:* There is a short migration guide here: https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md#700-rc0-2020-09-14

Aslak Hellesøy
2020-09-17 07:35:11

*Thread Reply:* Does @cucumber/cucumber play nice with @wdio ? Yes. Cucumber plays nice with anything you put inside your step definitions or hooks, because it is blissfully ignorant of what your code does. It just reports errors if your code throws errors.

Mona Ghassemi
2020-09-17 07:37:40

*Thread Reply:* Ok I guess I'll have to see since I'm not exactly sure why when I was trying to run cucumber for my current test framework (which has a different dependency structure than a past one where I used webdriverio and launched things with cucumber, it was reporting 0 tests, vs running wdio commands. Perhaps I was using it incorrectly.

Mona Ghassemi
2020-09-17 07:40:46

*Thread Reply:* I'll have to investigate. Thanks for sharing the migration guide!

Aslak Hellesøy
2020-09-17 07:41:24

*Thread Reply:* Good luck - let us know if anything is missing.

Mona Ghassemi
2020-09-17 07:29:55

Actually I have "cucumber": "^6.0.5", in my dependencies as well.

jjhessouh
2020-09-17 16:41:21

@jjhessouh has joined the channel

aberdan
2020-09-18 09:55:00

@aberdan has joined the channel

aberdan
2020-09-18 10:28:11

Hello, my team ran into an issues with cucumber. We have identical step definitions for multiple test cases. For example: "User accepts terms and conditions", etc. We get an error "Multiple step definitions match". How can we use Cucumber without rewriting all of our test cases? Thank you.

Cat
2020-09-18 10:34:02

*Thread Reply:* There are a few options. You can set it at configuration - when you pass the step defs in, just pass in the ones you want to use. You can also modify the step definitions themselves to have a conditional function that determines which behavior should be leveraged. However, the best practice is for your language to be expressive. Having ambiguous language that could indicate multiple different behaviors tends to bite you in the ass later.

☝️ Mona Ghassemi
Mona Ghassemi
2020-09-18 10:34:04

*Thread Reply:* You should only need to write the step definition once. You can then re-use it in multiple tests. If you are attempting to write step definitions that have the same name but perform different actions, consider changing one of them to be more specific.

aberdan
2020-09-18 10:44:23

*Thread Reply:* @Cat - test manager wrote a large number of test cases/scenarios and she expects that it will be a big overload to rewrite them in a unique way. Since Cucumber is well known and widely used, I had a hope that there is a better and less time consuming solution.

aberdan
2020-09-18 10:50:39

*Thread Reply:* @Mona Ghassemi - I am not sure I follow your line of thoughts completely. We use Jenkins and Xray for Jira. We will have to have multiple feature files in one repository branch to be able to do testing and get report back to Xray. Let's say we have 100 test scenarios and 50% have steps which have to be repeated. The idea of rewriting the test scenarios is pushing our manager to get rid of Cucumber. Question - how to save Cucumber? 😄

Cat
2020-09-18 10:52:11

*Thread Reply:* You don’t need a rewrite. You need abstraction.

👆 Mona Ghassemi
Cat
2020-09-18 10:52:19

*Thread Reply:* It’ll scale better and save you time long-term

Cat
2020-09-18 10:52:29

*Thread Reply:* It’ll also keep your tests more stable

Cat
2020-09-18 10:53:35

*Thread Reply:* They don’t all need to be unique. Quite the opposite. They can be paramaterized in such a way that they can be quite flexible. It’s a time investment, but all test automation is (and should be). If she isn’t anticipating that, she got into the wrong line of business

🙌 aberdan
aberdan
2020-09-18 10:58:12

*Thread Reply:* If it would be up to me - I would modify the test scenarios a bit. I even did add one extra word in the second scenario ("the user" instead of "user") to show my manager that we do not have to rewrite a lot. But she did not like it. She think that it will take a lot of maintenance to continue the project. 🧐 I disagree but ...

aberdan
2020-09-18 10:59:55

*Thread Reply:* @Cat - thanks for the input. I thought it was my duty to check if we can do something else on the test engineers side.

Mona Ghassemi
2020-09-18 11:20:07

*Thread Reply:* @aberdan I don't think adding extra words like "the" is of any help. Cat's comments on abstraction and parametrization are on point.

Cat
2020-09-18 11:21:58

*Thread Reply:* Part of the reason that you don’t want to have step defs that are too similar or identical is because it then becomes very difficult to determine what they’re doing. Look instead at the step definitions to see why they’re different. Are they actually that different? You may find that they aren’t, or you may find that some added conditional handling and state control will go a long way.

Cat
2020-09-18 11:23:04

*Thread Reply:* The purpose of the scenarios is to express the behavior. If you have 5 different step definitions that do different things, but are verbally expressed the same way, that makes it harder to detangle the behavior, not easier, which defeats the point.

Cat
2020-09-18 11:24:31

*Thread Reply:* If I say Given the user has logged in and one of my step defs logs into a completely different application, I’m screwing myself over. Even if it’s just a differently permissioned user or there are slightly different UI flows involved, it doesn’t necessarily express the state and, as a result, introduces confusion rather than eliminating it

Cat
2020-09-18 11:26:41

*Thread Reply:* So given the situation, I’d consider timeboxing it to see how many step defs you have for a given thing and what they actually do. Are they doing the same thing, effectively? Do they maybe just have slightly different selectors? Can they be condensed to a single step def? That’s going to help you champion cucumber better if you can show the streamlined step definitions and expressive feature files

aberdan
2020-09-18 12:02:03

*Thread Reply:* As an example (terms and conditions page has two check boxes - for privacy policy and for terms and conditions): Scenario 1: Test accept privacy policy only Given user has activated account Then user navigates to terms and conditions page where terms and conditions can be reviewed And user can click the terms and conditions side bar to scroll down to the bottom of the page where check boxes are visible When user accepts only the privacy policy And clicks the Register button Then user cannot progress to the next page When user accept terms and conditions and privacy policy And then clicks the Register button again Then user is taken to the Utility Page

Scenario 2: Test accept terms and conditions only Given user has activated account Then user navigates to terms and conditions page where terms and conditions can be reviewed And user can click the terms and conditions side bar to scroll down to the bottom of the page where check boxes are visible When user accepts only the terms and conditions And clicks the Register button Then user cannot progress to the next page When user accept terms and conditions and privacy policy And then clicks the Register button again Then user is taken to the Utility Page

As you can see, only step #4 is different, all other steps are the same. And it is just one example, we have much more in our backlog in Jira. I do not write the Cucumber scenarios, I write JavaScript code for automated testing and we have no problems with JS. What should we do? Does the test manager have to write one Scenario for steps 1-3 and another scenario for steps 5-9? Which then can be reused when needed?

Cat
2020-09-18 13:40:04

*Thread Reply:* ok so, firstly: you’re testing something twice. Imo, you need to have a distinct scenario for the positive case (acceptance of both policies). Then there’s a separate scenario for each of the negative conditions (having only one of the policies checked). Secondly: there are a few ways you can streamline this to be more elegant and have more DRY code. For example: All you have to say is “When user accepts <policy>” That’s a single step def that takes an arg. That’s all it has to be. Just have it take a parameter and, based on what you pass in, it clicks whichever checkbox. Similarly: “And then clicks the Register button again” - this is unnecessarily redundant. Just say “And clicks the Register button” - it’s the same action, no matter what. If it’s the same action, use the same words.

Cat
2020-09-18 13:40:23

*Thread Reply:* These kinds of things will help make the code and the features less repetitive. It’ll become faster over time.

Cat
2020-09-18 13:40:40

*Thread Reply:* It also helps you spot areas where the code can be abstracted to make it more efficient

aberdan
2020-09-18 13:49:09

*Thread Reply:* @Cat - a personal huge Thank you! Everything you said makes a lot of sense to me. I will try to convince my manager to restructure the test cases in a less redundant way. I hope she will listen. 🙂

Cat
2020-09-18 14:22:07

*Thread Reply:* Happy to know this was helpful!

💯 aberdan
Hanaan Yousaf
2020-09-18 14:55:15

@Hanaan Yousaf has joined the channel

Hanaan Yousaf
2020-09-18 15:19:41

hello I can't figure out why this AssertionError message gets lost

Hanaan Yousaf
2020-09-19 14:01:17

*Thread Reply:* I figured it out - these lines in node-assertion-error-formatter cause me to lose my assertion message because my message starts with "expected"

Hanaan Yousaf
2020-09-18 15:20:24

F1, type "shell", npm run test-cucumber to get it going 🙂

Mona Ghassemi
2020-09-21 07:01:34

*Thread Reply:* node v12.16.1  shell ReferenceError: shell is not defined at repl:1:1 at Script.runInContext (vm.js:130:18) at REPLServer.defaultEval (repl.js:435:29) at bound (domain.js:427:14) at REPLServer.runBound [as eval] (domain.js:440:12) at <a href="http://REPLServer.onLine">REPLServer.onLine</a> (repl.js:760:10) at REPLServer.emit (events.js:315:20) at REPLServer.EventEmitter.emit (domain.js:483:12) at REPLServer.Interface._onLine (readline.js:329:10)  npm run test-cucumber npm should be run outside of the node repl, in your normal shell. (Press Control-D to exit.)      npm run test-cucumber npm should be run outside of the node repl, in your normal shell. (Press Control-D to exit.)  

Hanaan Yousaf
2020-09-21 07:17:08

*Thread Reply:* thanks for replying Mona. If you wait for the editor to load then press F1 while in one of the files, then type shell you should see this

Hanaan Yousaf
2020-09-21 07:17:10

*Thread Reply:*

Hanaan Yousaf
2020-09-21 07:18:26

*Thread Reply:* but I figured out the reason it was happening and posted it here ... https://github.com/charlierudolph/node-assertion-error-formatter/issues/3

HanaanY (https://github.com/HanaanY)
SMHA
2020-09-21 09:07:24

hey guys, is there anyway to test commonjs modules using cucumber?

slackbot
2020-09-21 09:07:25

Salutations Earthling! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

SMHA
2020-09-21 09:07:33

exports are getting erros

Cat
2020-09-21 09:38:15

*Thread Reply:* can you give an example of the usage and the error please?

SMHA
2020-09-21 10:35:02

*Thread Reply:* we have:

SMHA
2020-09-21 10:35:15

*Thread Reply:* export { app };

SMHA
2020-09-21 10:35:42

*Thread Reply:* we get TypeError: Cannot read property 'address' of undefined

Cat
2020-09-21 10:48:50

*Thread Reply:* You should be able to use babel. (I assume you can also use webpack, but I’m personally more familiar w/babel).

SMHA
2020-09-21 10:59:47

*Thread Reply:* we are using babel

SMHA
2020-09-21 10:59:53

*Thread Reply:* our app builds

SMHA
2020-09-21 11:00:02

*Thread Reply:* with webpack we use namedmodulesplugin

SMHA
2020-09-21 11:00:04

*Thread Reply:* and it works

SMHA
2020-09-21 11:00:26

*Thread Reply:* cucumber though can't understand commonjs exports it seems

SMHA
2020-09-21 11:00:49

*Thread Reply:* if we change it to module.exports = app cucumber works, but then our app doesn't build

Cat
2020-09-21 11:03:38

*Thread Reply:* Right. Natively, cucumber isn’t going to be able to leverage commonjs exports. You have to configure that explicitly. It’s distinct from your application transpile.

SMHA
2020-09-21 11:08:48

*Thread Reply:* how do i do that

Cat
2020-09-21 11:12:20

*Thread Reply:* This discussion gives some high level instructions. As mentioned, you’ll want to configure something to the effect of "presets": [["env",{"modules":"commonjs"}]] You may need to fiddle around with it a bit. This was ~2 years ago, looks like, so some of the verbiage could have changed since then. When in doubt, check the babel docs.

gitter.im
SMHA
2020-09-21 11:20:01

*Thread Reply:* tried it, it's not working

Cat
2020-09-21 11:29:59

*Thread Reply:* Ok. Without knowing how you’ve configured it, how you’re running it, what commands you’re using it, or anything about what you’re trying to run, there’s very little I can do to help other than point you in the right direction. 🤷

SMHA
2020-09-21 09:09:17

with webpack we can have namedmodulesplugin to enable commonjs modules

SMHA
2020-09-21 09:09:28

is there a similar thing for cucumber?

Patrick
2020-09-22 11:13:57

@Patrick has joined the channel

Spencer Bragg
2020-09-25 05:44:12

@Spencer Bragg has joined the channel

Spencer Bragg
2020-09-25 06:01:55

Hello All! I am new to the channel and pretty new to cucumber. I have an angular app that I am trying to implement the same way as the example in the repo, but am running into alot of trouble. Is there any articles, posts, or help that could steer me in the right direction. Basically i'm looking to have an exact replica of the example just in angular.

Cat
2020-09-28 06:17:34

*Thread Reply:* That’s going to be an angular question - not a cucumber question.

MMagdy
2020-09-29 02:16:23

Hello all I have 2 feature files Feature file 1 Scenario: Scenario 1 Given When Then Feature file 2 Scenario: Scenario 2 Given When Then here I have the same Given, When, and Then in the both files so i get the following error Multiple step definitions match is this normal to have unique Given, When, and Then over the whole code ?

luke
2020-09-29 02:49:40

Given / When / Then are essentially just irrelevant (When writing steps)>

That's not to say they "should" be. Just they are at the moment.

luke
2020-09-29 02:50:29

Ideally though you would change the language for a given / when / then.

Given should be a Precondition - i.e. something has happened (Usually past tense) When should be an Action - i.e. something is happening (Present tense) Then is an assertion - i.e. you expect something (Future tense)

☝️ A guide. Not the set rules ☝️

luke
2020-09-29 02:51:21

Given I am called Harry When I select the user called Harry Then a user called Harry is present

luke
2020-09-29 02:51:51

or maybe

Given I am Harry When I select Harry Then I will see Harry

Cat
2020-09-29 06:37:00

your step definitions need to be unique. You can reuse the steps themselves within a feature file, but a specific step needs to be unique.

Md. Borhan Uddin Sarker
2020-09-29 08:31:31

@Md. Borhan Uddin Sarker has joined the channel

Kyle Bailey
2020-09-30 07:07:05

@Kyle Bailey has joined the channel

Kyle Bailey
2020-09-30 07:08:34

Hello, I'm trying to make a custom formatter to append timestamps to the json output, but am running into difficulties. I created a custom formatter that listens to the eventBroadcaster events, and am calling log(data), but the data isn't showing up in the json output. Was hoping for guidance on the proper way to get the custom formatter to show up in the json output

Aslak Hellesøy
2020-09-30 13:21:09

@Kyle Bailey the JSON formatter is deprecated: • https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md#breaking-changeshttps://github.com/cucumber/cucumber/blob/master/messages/README.md

Jonas Amundsen
2020-10-01 03:09:55

Hi! Regarding custom parameters and regular expressions, if mine contains a union, must I wrap it in a capturing / non-capturing group to not let the union operator mess with the resulting expression or will Cucumber do that for me?

Aslak Hellesøy
2020-10-01 03:45:12

*Thread Reply:* Can you give an example @Jonas Amundsen?

Jonas Amundsen
2020-10-01 03:53:29

*Thread Reply:* Yes! Provided I have configured a parameter as shown below.

defineParameterType({ name: "foobar", regexp: /foo|bar/ }); Furthermore I have a step definition like

When("I put a {foobar} in my inventory", (fooOrBar) =&gt; { ... }); My understanding is that cucumber-expression will compile an expression, but if the resulting expression is a mere interpolation EG. /^I put a foo|bar in my inventory$/ , then that will probably have unexpected results

Aslak Hellesøy
2020-10-01 03:55:49

*Thread Reply:* The expression will match these steps:

I put a foo in my inventory I put a bar in my inventory Anything else will not match. What do you mean by interpolation? What kind of unexpected results are you anticipating?

Jonas Amundsen
2020-10-01 04:01:20

*Thread Reply:* I'm mostly curious at this point about the workings of cucumber-expressions and I'm not experiencing anything out of the ordinary or what you describe

Jonas Amundsen
2020-10-01 04:01:47

*Thread Reply:* Am I correct to assume that using anchors for start / end of string will mess with it?

Aslak Hellesøy
2020-10-01 08:56:28

*Thread Reply:* Yes. Regular Expressions is a language with its own syntax rules. Cucumber Expression is also a language with its own syntax rules. You can't mix them. It's like Russian and Spanish.

Kyle Bailey
2020-10-01 05:37:42

@Aslak Hellesøy Just because it's deprecated shouldn't mean I'm unable to attempt what I'm doing. How about this. How can I write a custom formatter to write to a file from intercepting events, while simultaneously using the progress output via stdout?

Aslak Hellesøy
2020-10-01 08:58:52

*Thread Reply:* Of course - I just wanted to give you a heads up since we plan to remove the JSON formatter from future versions of Cucumber.

Have you seen this? https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md

^^ @Kyle Bailey

Kyle Bailey
2020-10-01 09:19:31

*Thread Reply:* Ah, gotcha!

I have, and I made a custom formatter that does what I want, but I'm uncertain how to let that formatter run in parallel to the standard formatter

Aslak Hellesøy
2020-10-01 09:20:24

*Thread Reply:* @Kyle Bailey you can specify multiple formatters on the command line. Cucumber will send events to all of them. You shouldn't need to worry about what order they run in.

Adam Merritt
2020-10-05 15:41:45

@Adam Merritt has joined the channel

Adam Merritt
2020-10-05 15:43:39

Hi -for v7 , the scenario.result.exception was removed from the HookScenarioResult (now ITestCaseHookParameter). Why was this? Is there a recommended way to get the exception from step failures? I coul duse setFunctionDefinitionWrapper but I'd rather avoid that.

Aslak Hellesøy
2020-10-06 00:56:08

*Thread Reply:* @Adam Merritt I believe it was removed because we changed the internal data structures as events were refactored to use cucumber-messages: https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md#breaking-changes

What do you need scenario.result.exception for? Perhaps we can suggest an alternative approach?

Adam Merritt
2020-10-06 06:42:49

*Thread Reply:* I'm using cucumber for UI automation testing and have an error type that will store the Dom structure as JSON when it throws. The problem is I want that piece (the UI interface) decoupled from Cucumber, so it wouldn't have access to the World

Adam Merritt
2020-10-06 06:43:49

*Thread Reply:* If I use "Set definition function wrapper " then it's dependent on no other component overriding it

IanM
2020-10-07 03:18:17

@IanM has joined the channel

Mona Ghassemi
2020-10-07 07:12:21

Does cucumber-pretty work with the new @cucumber/cucumber package? When I try to run with it ./node_modules/.bin/cucumber-js -f node_modules/cucumber-pretty I get Error: Cannot find module 'cucumber' but running without cucumber-pretty is fine. Is there an alternative?

Mona Ghassemi
2020-10-07 07:19:05

Works when I change the require inside cucumber-pretty. I suppose I should go bug the package maintainer 🙂

Mona Ghassemi
2020-10-07 07:21:55

*Thread Reply:* it's already there https://github.com/kozhevnikov/cucumber-pretty/issues/14 🙂

mattwynne (https://github.com/mattwynne)
Comments
3
👍 Jo Laing
IanM
2020-10-08 02:03:09

Hi everyone. Is it possible to call features in the command line whilst passing a variable to them?

Kārlis Amoliņš
2020-10-08 11:18:03

@Kārlis Amoliņš has joined the channel

Balazs Mandel
2020-10-09 05:05:59

@Balazs Mandel has joined the channel

plocket
2020-10-11 08:05:11

@plocket has joined the channel

plocket
2020-10-11 08:10:03

I’m trying to write an npmjs package to provide our developers with pre-built steps so they only have to write the cucumber files. I’ve made node packages before, but not like this and I’m getting stuck repeatedly. Before working on making it… executable…? my first step has been to try to make a package that someone can require in their ./support/steps.js that will just provide all the steps. I’m bringing in the file locally with npm link and I’m getting Cannot set property 'World' of undefined. What other information can I give that could help get me closer to my goal?

Also, is there any point to doing this or should I try to jump straight to… whatever I need to jump to so that folks won’t need any .js files?

Aslak Hellesøy
2020-10-11 09:00:29

*Thread Reply:* 9 years ago I discovered that prebuilt step definitions are a bad idea: https://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off

Aslak Hellesøy
plocket
2020-10-11 09:01:51

*Thread Reply:* I will read! I suspect I have a different use case than is normally in here.

plocket
2020-10-11 09:13:04

*Thread Reply:* I really enjoyed that. Well written article and it brings up a lot of good points and makes me question if cucumber really is the solution we’re looking for. Do you have bandwidth for a full discussion in here, @Aslak Hellesøy?

plocket
2020-10-11 09:13:48

*Thread Reply:* I don’t think Capybara will serve our needs.

Aslak Hellesøy
2020-10-11 09:18:27

*Thread Reply:* The point I’m trying to make in that article is that scenarios should reflect domain language and business rules. Not the user interface.

plocket
2020-10-11 09:19:09

*Thread Reply:* It makes sense, and that’s why maybe another tool is better for us than cucumber - we’re testing interface, not domain/business rules.

plocket
2020-10-11 09:19:23

*Thread Reply:* One of the problems is that we need humans to be able to write them.

Aslak Hellesøy
2020-10-11 09:19:36

*Thread Reply:* Cucumber is not a testing tool :-)

plocket
2020-10-11 09:20:27

*Thread Reply:* Yeah, I’m learning that. What else could work for us?

plocket
2020-10-11 09:21:02

*Thread Reply:* We need something that lets us write human sentences to test forms for correct behavior.

Aslak Hellesøy
2020-10-11 09:21:11

*Thread Reply:* So you may well have more success using a different tool. Related articles: https://cucumber.io/blog/collaboration/the-worlds-most-misunderstood-collaboration-tool/ and https://cucumber.io/blog/bdd/bdd-is-not-test-automation/

cucumber.io
cucumber.io
plocket
2020-10-11 09:21:53

*Thread Reply:* Our team’s not doing BDD, right?

Aslak Hellesøy
2020-10-11 09:21:55

*Thread Reply:* You can do that with Cucumber, but your tests will be brittle, slow and hard to maintain

plocket
2020-10-11 09:22:14

*Thread Reply:* Is there something else we can do that with that would be better?

plocket
2020-10-11 09:22:45

*Thread Reply:* We’re basically doing regression testing, we just need humans to be able to write it, not coders.

plocket
2020-10-11 09:24:00

*Thread Reply:* We’re working on putting out emergency court forms like stopping evictions and requesting help with domestic violence. Those forms have certain things about them that absolutely have to work for them to be safe for people to use them.

plocket
2020-10-11 09:24:35

*Thread Reply:* We don’t have a ton of coders. We do have volunteers, most of them with legal experience (which doesn’t help much).

plocket
2020-10-11 09:27:24

*Thread Reply:* Some tests aren’t just ‘click this button’ and ‘type this in’. We’re building a framework so that these can be more easily created and deployed. That is, all the pages that ask for names will be the same. That can let us build a step that fills in a name on a name page. We haven’t figured out how to abstract more than that without every form maker having to write code that they don’t have time to learn.

Aslak Hellesøy
2020-10-11 09:28:35

*Thread Reply:* I’d recommend trying out a declarative style rather than imperative. Ben Mabey’s original blog post is gone I think, but here is a riff on it: http://blog.nickcox.me/2012/12/17/refactoring-cucumber/

plocket
2020-10-11 09:28:36

*Thread Reply:* We also want people to be able to re-use the tests we write, of course, which is why I’m trying to make a package.

Aslak Hellesøy
2020-10-11 09:29:28

*Thread Reply:* Note that a declarative approach is incompatible with pre-built step definitions, which tend to be imperative.

Aslak Hellesøy
2020-10-11 09:31:01

*Thread Reply:* I really recommend that step definitions are written, maintained and refactored by the same people who build the application.

plocket
2020-10-11 09:32:07

*Thread Reply:* We’re teaching the volunteers to code, but they’re coding in python in a framework that simplifies a lot of what they do. They’re not ready to write files like “#spec/acceptance/forms/feedback_steps.rb”

plocket
2020-10-11 09:32:32

*Thread Reply:* I understand that in an ideal world we’d have the money to hire more coders, but we don’t have that.

Aslak Hellesøy
2020-10-11 09:33:26

*Thread Reply:* I understand. I think you should try what you’re planning. It might work out, but just wanted to warn you of some common pitfalls.

plocket
2020-10-11 09:36:18

*Thread Reply:* For sure, and these are really good points. I’m going to bring them up with the team and see what people think we can do about these. I can’t currently think how to account for them within our budget, but maybe someone else will have an idea.

So far the test writing has gone pretty well, but we’re copying the step code into every repo. No one can take advantage of updates very easily. The volunteers are not great at using github and it’s taking a lot of developer time to update the steps.js files, etc.

plocket
2020-10-11 09:36:30

*Thread Reply:* That’s why I was trying to make a package.

plocket
2020-10-11 09:41:03

*Thread Reply:* Right now I’ve set aside time to learn how to make a package that can take care of some abstractions. No pressure, but is that something you have knowledge about and a discussion you have bandwidth for, @Aslak Hellesøy? I understand if you feel I’m just wasting your time. I can try to find answers somewhere else.

plocket
2020-10-11 09:43:51

*Thread Reply:* We need to figure out something that can take pressure off of testing by hand. We have some forms that can take 30 - 45 min. to fill out [accurately by a human] (like the domestic abuse one).

Aslak Hellesøy
2020-10-11 09:47:37

*Thread Reply:* I'm afraid I don't have much time to help. I recommend you start an issue on GitHub with as much detail as possible. What you're trying to do might even require a change to Cucumber.js - I'm not sure.

plocket
2020-10-11 09:48:34

*Thread Reply:* Ok, thanks. Do you have a sec to give me tips on how to improve my question so that it provides better context or is more clear?

Aslak Hellesøy
2020-10-11 09:48:45

*Thread Reply:* Also, just wanted to say I think it's great Cucumber is used for what you're working on!

plocket
2020-10-11 09:49:46

*Thread Reply:* Thanks! So far it really has saved us a ton of time and let us re-focus on the users. Just need to make the ecosystem easier to expand on.

plocket
2020-10-11 08:13:45

Is this the right channel or should I just try #help ?

plocket
2020-10-11 10:58:25

☝️ Would still appreciate help if someone sees the above and has some insights.

plocket
2020-10-11 12:22:17

Got the tests package working, though not really in the way I want - the developer still needs a require in one of the scripts. The package also doesn’t have access to .env. I tried to put #!/usr/bin/env node at the top of index.js, but it didn’t help.

If someone has insights on how I could take all requirements scripts other than .feature out of there, I’d love to hear them. If not, I may make an issue on github if I can put together the time to do it.

Thanks for the insights so far!

Jeremy Lorino
2020-10-11 16:58:46

@Jeremy Lorino has joined the channel

Jeremy Lorino
2020-10-11 16:59:50

@plocket still having issues?

plocket
2020-10-11 17:01:17

Hi @Jeremy Lorino. I’m still stuck where I was at my last report. Not really sure what to look into next to make progress.

plocket
2020-10-11 17:01:30

Even this is better than before, though.

Jeremy Lorino
2020-10-11 17:02:21

Do you have code in github or something to look at?

plocket
2020-10-11 17:03:20

*Thread Reply:* This is the package: https://github.com/plocket/docassemble-cucumber

Jeremy Lorino
2020-10-11 17:03:51

*Thread Reply:* Perfect. Let me take a quick look

Jeremy Lorino
2020-10-11 17:12:00

*Thread Reply:* So I as a developer would use this package?

And one of the main issues is not having env vars or config?

Jeremy Lorino
2020-10-11 17:14:37

*Thread Reply:* I prefer to use https://www.npmjs.com/package/config over dotenv in a situation like this

npm
Jeremy Lorino
2020-10-11 17:16:09

*Thread Reply:* Let me pull it down and see if I can use it as a consumer

plocket
2020-10-11 17:17:52

*Thread Reply:* Thanks. I’ll take a look at config. I’m still not sure how to get it so the developers don’t have to write any .js files, just .feature files.

Jeremy Lorino
2020-10-11 17:27:00

*Thread Reply:* so i should be able to do this right?

const Framework = require("docassemble-cucumber"); console.log("Framework", Framework);

Jeremy Lorino
2020-10-11 17:31:35

*Thread Reply:* because that doesn't work i get cucumber errors

plocket
2020-10-11 17:32:08

*Thread Reply:* I’m not sure you should be able to log anything, you just need to be able to use a .features file with it.

Jeremy Lorino
2020-10-11 17:32:30

*Thread Reply:* ok so what's an example developer setup?

Jeremy Lorino
2020-10-11 17:34:14

*Thread Reply:* alright letme test

plocket
2020-10-11 17:34:20

*Thread Reply:* Don’t try setup and takedown

plocket
2020-10-11 17:34:24

*Thread Reply:* They’re for github

Jeremy Lorino
2020-10-11 17:34:43

*Thread Reply:* 👍

Jeremy Lorino
2020-10-11 17:36:15

*Thread Reply:* npm run cucumber?

plocket
2020-10-11 17:36:51

*Thread Reply:* Yeah

Jeremy Lorino
2020-10-11 17:37:10

*Thread Reply:* alright letme get a feature file

plocket
2020-10-11 17:37:32

*Thread Reply:* Only opening the interview will work for you if you’re not visiting the right sight, though, so you might only be able to ‘start an interview at’

Jeremy Lorino
2020-10-11 17:38:12

*Thread Reply:* well i assume i'd need a feature file specific to your tests cases ya?

plocket
2020-10-11 17:38:43

*Thread Reply:* I’ve updated the gist with example test file

Jeremy Lorino
2020-10-11 17:40:55

*Thread Reply:*

Jeremy Lorino
2020-10-11 17:41:02

*Thread Reply:* closer 😄

plocket
2020-10-11 17:42:38

*Thread Reply:* y’know what, there’s no reason you shouldn’t be able to run it with the test repo. Just a sec.

Jeremy Lorino
2020-10-11 17:42:41

*Thread Reply:* ok so cucumber doesn't know where the impls are

plocket
2020-10-11 17:43:46

*Thread Reply:* Use the npmjs branch and don’t bother trying to do anything other than running the tests.

Jeremy Lorino
2020-10-11 17:43:59

*Thread Reply:* kk

plocket
2020-10-11 17:44:24

*Thread Reply:* Sorry I didn’t think of that sooner.

Jeremy Lorino
2020-10-11 17:44:32

*Thread Reply:* np

Jeremy Lorino
2020-10-11 17:44:38

*Thread Reply:* letme setup

Jeremy Lorino
2020-10-11 17:45:39

*Thread Reply:* npm test or npm run cucumber

Jeremy Lorino
2020-10-11 17:47:23

*Thread Reply:* the world can't get setup

plocket
2020-10-11 17:48:06

*Thread Reply:* npm run cucumber

Jeremy Lorino
2020-10-11 17:48:16

*Thread Reply:* thats what i did

plocket
2020-10-11 17:48:18

*Thread Reply:* That’s weird. I have it working for myself locally.

plocket
2020-10-11 17:48:24

*Thread Reply:* Hang on

Jeremy Lorino
2020-10-11 17:48:39

*Thread Reply:* probs those env variables you were talking about

plocket
2020-10-11 17:48:59

*Thread Reply:* Can’t be because the file’s not able to use them anymore.

plocket
2020-10-11 17:49:46

*Thread Reply:* Did you npm install all the peer dependencies?

Jeremy Lorino
2020-10-11 17:49:54

*Thread Reply:* yep

plocket
2020-10-11 17:50:18

*Thread Reply:* That’s not great then.

plocket
2020-10-11 17:51:08

*Thread Reply:* Trying to dig to see what might be going wrong.

plocket
2020-10-11 17:51:27

*Thread Reply:* Just going to double check - you’re using the npmjs branch?

Jeremy Lorino
2020-10-11 17:51:42

*Thread Reply:*

plocket
2020-10-11 17:51:51

*Thread Reply:* Damn

plocket
2020-10-11 17:52:02

*Thread Reply:* Let me pull it down in a clean folder

Jeremy Lorino
2020-10-11 17:52:16

*Thread Reply:* ran npm i npm link docassemble-cucumber npm run cucumber

plocket
2020-10-11 17:52:26

*Thread Reply:* Oh, don’t link

plocket
2020-10-11 17:52:49

*Thread Reply:* It should just be from the published npmjs package.

Jeremy Lorino
2020-10-11 17:52:58

*Thread Reply:* alright i'll use that one

Jeremy Lorino
2020-10-11 17:53:10

*Thread Reply:* assumed it was ===

Jeremy Lorino
2020-10-11 17:53:48

*Thread Reply:* success?

plocket
2020-10-11 17:54:10

*Thread Reply:* Yes!

Jeremy Lorino
2020-10-11 17:54:22

*Thread Reply:* glad i could do nothing lol

plocket
2020-10-11 17:54:33

*Thread Reply:* lol

plocket
2020-10-11 17:55:01

*Thread Reply:* You at least confirmed it works on someone else’s environment. Other people are taking the weekend off for some crazy reason.

plocket
2020-10-11 17:55:09

*Thread Reply:* Anyway, that’s it with a require

Jeremy Lorino
2020-10-11 17:55:20

*Thread Reply:* wierdos

💯 plocket
Jeremy Lorino
2020-10-11 17:55:44

*Thread Reply:* ya i saw the require in steps.js

Jeremy Lorino
2020-10-11 17:56:23

*Thread Reply:* how do you want it to work?

plocket
2020-10-11 17:56:42

*Thread Reply:* Trying to get rid of as many files as I can to simplify the process for folks. I wanted to reduce the number of folders and put everything in features, but someone brought up our desire for unit tests in the future.

plocket
2020-10-11 17:57:06

*Thread Reply:* Ideally developers would only have to write .feature files and there’d be as little setup as possible.

Jeremy Lorino
2020-10-11 17:57:40

*Thread Reply:* ./run-my-files tests/** **/ **.feature?

plocket
2020-10-11 17:57:49

*Thread Reply:* Yeah

Jeremy Lorino
2020-10-11 17:58:00

*Thread Reply:* hold please

Jeremy Lorino
2020-10-11 17:58:30

*Thread Reply:* wait whats diff between the main package and the published one?

plocket
2020-10-11 17:58:59

*Thread Reply:* Nothing at the moment

Jeremy Lorino
2020-10-11 17:59:08

*Thread Reply:* so my link should have worked

plocket
2020-10-11 17:59:23

*Thread Reply:* Yeah, except it doesn’t. I haven’t been able to get it to.

plocket
2020-10-11 18:00:50

*Thread Reply:* I can see that providing ~the~ [that] link was misleading. Learning a lot about communication today.

Jeremy Lorino
2020-10-11 18:01:04

*Thread Reply:* lol

Jeremy Lorino
2020-10-11 18:10:12

*Thread Reply:* where is this? Error: Cannot find module './interview-constants.js'

Jeremy Lorino
2020-10-11 18:10:50

*Thread Reply:* whoops nvm

plocket
2020-10-11 18:11:13

*Thread Reply:* Yeah, trying to get rid of those env vars, but you shouldn’t be trying to trigger them anyway for this part.

Jeremy Lorino
2020-10-11 18:25:02

*Thread Reply:* you should probably package cucumber with your package

plocket
2020-10-11 18:33:44

*Thread Reply:* I got recommended to only include it as a peer dependency. I guess I’ll put one vote for each so far, lol.

Jeremy Lorino
2020-10-11 18:38:22

*Thread Reply:* meh it should work

plocket
2020-10-11 18:41:41

*Thread Reply:* How the heck…

Jeremy Lorino
2020-10-11 18:42:04

*Thread Reply:* before you do it all. do a npm i -g . inside your package

plocket
2020-10-11 18:42:06

*Thread Reply:* How to make that work with cucumber steps, though?

plocket
2020-10-11 18:42:43

*Thread Reply:* Oh, I think I see some of what you’re doing.

Jeremy Lorino
2020-10-11 18:42:47

*Thread Reply:* i'm still running in ~/source/repos/docassemble-IntegratedTesting

Jeremy Lorino
2020-10-11 18:42:59

*Thread Reply:* so it's still pulling those steps

plocket
2020-10-11 18:43:12

*Thread Reply:* I’m a bit distracted with some kind of …memory leak? in my computer right now that makes it think my folders have a ton of files in them.

Jeremy Lorino
2020-10-11 18:43:36

*Thread Reply:* well thats awesome

Jeremy Lorino
2020-10-11 18:44:25

*Thread Reply:* if you get rid of that steps.js it won't work

Jeremy Lorino
2020-10-11 18:44:37

*Thread Reply:* i'm not sure how to tell cucumber where to look for the stesps

Jeremy Lorino
2020-10-11 18:44:42

*Thread Reply:* probably in their cli

plocket
2020-10-11 18:45:36

*Thread Reply:* I may not have to move the steps if I do what your code just did. I’ll have to try it after I figure out how to keep my computer from exploding.

Jeremy Lorino
2020-10-11 18:46:05

*Thread Reply:* cool. good luck

plocket
2020-10-12 04:54:38

*Thread Reply:* If you’re ever back on, @Jeremy Lorino, I’m trying to replicate your file and I’m not sure where to require the files for the package - scope.js, world.js, etc. Where does that happen?

plocket
2020-10-12 04:55:19

*Thread Reply:* Other than that, I’m also curious about what’s going on there, but I can probably look that up myself.

plocket
2020-10-12 08:00:16

*Thread Reply:* I think I may be using it closer to what was intended now and I’m getting: Command failed: sh stuff/node_modules/.bin/cucumber-js tests/features/interactive.feature tests/features/observations.feature stuff/node_modules/.bin/cucumber-js: line 3: syntax error near unexpected token `'../lib/cli/run.js'' stuff/node_modules/.bin/cucumber-js: line 3: `require('../lib/cli/run.js').default();'

Jeremy Lorino
2020-10-12 08:04:15

*Thread Reply:* All my file did was pass through the list of files to cucumber-js

It requires a list of space delimited files

plocket
2020-10-12 11:09:59

*Thread Reply:* So it needs the files from the package as well? [I’ll just try it out]

plocket
2020-10-12 11:12:55

*Thread Reply:* Do you have any ideas about what the syntax error is?

Jeremy Lorino
2020-10-12 11:15:36

*Thread Reply:* I would have to see the code. Not at my computer right now.

Push a branch and link it.

plocket
2020-10-12 11:49:25

*Thread Reply:* It’s pushed to main. I can always revert to an old commit at v2.

plocket
2020-10-12 11:49:54

*Thread Reply:* Hmm, I’ll push to a branch on the testing repo, though.

plocket
2020-10-12 11:50:58

*Thread Reply:* Test repo branch is npmjs-direct

plocket
2020-10-12 18:23:46

*Thread Reply:* Thanks for all your help. A friend had some time and we figured out I just need to add the main file as required in the package script just before naming the path to the features. This was the line: https://gist.github.com/plocket/55c0079784265ca2a06630cf489f20da

plocket
2020-10-11 17:02:22

I think I can get rid of our .env needs for the non-executable stuff, so that also gets rid of a file we’d need people to add for this.

slackbot
2020-10-12 04:17:11

Bonjour! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

james
2020-10-12 22:37:02

@james has joined the channel

Jonathan Coombs
2020-10-15 08:43:01

@Jonathan Coombs has joined the channel

Austin Wood
2020-10-15 10:14:39

@Austin Wood has joined the channel

Mona Ghassemi
2020-10-16 11:44:24

Hello, I'm trying to get access to my cucumber stacktrace, which is only displaying when I have the --publish tag on, in the browser. I would like to be able to see the stacktrace in my terminal (I don't want to publish everytime)

Mona Ghassemi
2020-10-16 11:44:52

I tried using -b or --backtrace tags and neither worked

Mona Ghassemi
2020-10-16 11:45:15

using "@cucumber/cucumber": "^7.0.0-rc.0"

tooky
2020-10-19 03:18:09

Hey @Mona Ghassemi, can you show me the command you are running, please?

Aslak Hellesøy
2020-10-19 03:59:58

@Mona Ghassemi If the exception is thrown in asynchronous code (i.e. if your step definitions use promises or callbacks), then I don't think there is a way to make the stack trace include stack frames from Cucumber. This is a limitation of Node.js.

I'm surprised you're getting different stack traces in the HTML reports. Can you share a MCVE?

Mona Ghassemi
2020-10-19 07:28:48

@tooky "test": "./node_modules/.bin/cucumber-js features/PublicApi/publicApi.feature -r steps --require-module @babel/register --require-module @babel/polyfill --format usage"

tooky
2020-10-19 07:37:34

*Thread Reply:* I see you have --format usage set. I think this will show you which step definitions are used. Adding -b shouldn’t have any effect.

Are you seeing a table of steps or pass/fail reports?

Mona Ghassemi
2020-10-19 07:38:25

*Thread Reply:* I see the table.

Mona Ghassemi
2020-10-19 07:39:24

*Thread Reply:* It's not the best format but it's the best I could find. I think the format I am used to was cucumber-pretty but I realized it's no longer compatible with the new package.

tooky
2020-10-19 08:56:47

*Thread Reply:* @Mona Ghassemi --format usage doesn’t execute your scenarios so it won’t tell you if it is passing or failing. I think --format progress is what you are looking for.

tooky
2020-10-19 08:57:58

*Thread Reply:* there is a pretty formatter available, but unfortunately it doesn’t suppor the latest version of cucumber https://github.com/kozhevnikov/cucumber-pretty/issues/14

mattwynne (https://github.com/mattwynne)
Comments
3
Mona Ghassemi
2020-10-19 08:58:42

*Thread Reply:* yes, I was asking about this not long ago and then I read the Github discussion 😞

Mona Ghassemi
2020-10-20 14:11:23

*Thread Reply:* I don't like --format progress; it doesn't show my steps: ```..

1 scenario (1 passed) 2 steps (2 passed) 0m00.307s (executing steps: 0m00.303s)```

Mona Ghassemi
2020-10-20 14:15:04

*Thread Reply:* Oh I see usage is going to be weird once I add more scenarios...

tooky
2020-10-22 09:12:29

*Thread Reply:* yes --format progress will only show the steps on failed scenarios (if I remember correctly). But --format usage doesn’t actually run your scenarios so you won’t know if anything passes or fails.

Mona Ghassemi
2020-10-19 07:29:17

I removed the -b tag since it wasn't doing anything.

Mona Ghassemi
2020-10-19 07:29:31

I tried it in a couple places

Mona Ghassemi
2020-10-19 07:29:56

@Aslak Hellesøy I am using async/await

Aslak Hellesøy
2020-10-19 07:30:37

I think we'll need an mcve to reproduce this @Mona Ghassemi

Mona Ghassemi
2020-10-19 07:32:37

At the moment I have fixed the code so I no longer have an error to get a stacktrace. Next time I'm working on this I'll let you guys know and try to provide an MCVE (I had to look it up 🙂 )

slackbot
2020-10-19 07:32:38

Bonjour! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Mona Ghassemi
2020-10-19 07:33:04

I think you folks are in Europe, right?

Mona Ghassemi
2020-10-21 14:36:08

Hello, I'm trying to define cucumber parameters in a file as in this example: https://stackoverflow.com/questions/60758671/how-do-i-use-hooks-before-after-with-cucumber-js-tsflow

Stack Overflow
Mona Ghassemi
2020-10-21 14:36:27

Currently I am getting this error: TypeError: (0 , _cucumber.default) is not a function at Object.&lt;anonymous&gt; (/Users/.../support/world.js:9:1)

Mona Ghassemi
2020-10-21 14:39:57

*Thread Reply:* This is the code that line refers to: ```import setWorldConstructor from '@cucumber/cucumber' import setEnv from "../config/setEnv";

function CustomWorld() { this.ENV = setEnv() console.log(this.ENV) }

setWorldConstructor(CustomWorld) // <-- this is line 9```

Aslak Hellesøy
2020-10-21 15:07:38

*Thread Reply:* @Mona Ghassemi your import statement is incorrect. Try import { setWorldConstructor } from ‘@cucumber/cucumber’

Mona Ghassemi
2020-10-21 15:08:16

*Thread Reply:* Thank you!!!

Mona Ghassemi
2020-10-21 15:09:00

*Thread Reply:* it works now

Mona Ghassemi
2020-10-21 15:09:37

*Thread Reply:* Also I believe I found the documentation but it wasn't helping with this error; I was a bit thrown off 🙂

Mona Ghassemi
2020-10-21 15:09:50

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/master/features/profiles.feature for future reference in case anyone is looking at this

Mona Ghassemi
2020-10-21 14:36:55

I have a file at my project root like this: ```const common = [ 'features/PublicApi/publicApi.feature', '--require-module @babel/register', '--require-module @babel/polyfill', '--require steps/**/.js', // Load step definitions '--require support/hooks.js', // Load hooks '--require support/world.js', // Load world '--format progress-bar', // Load custom formatter ].join(' ');

module.exports = { default: common };```

Mona Ghassemi
2020-10-21 14:37:16

I am attempting to run command like this: "test": "node -r dotenv/config ./node_modules/.bin/cucumber-js -p default",

Mona Ghassemi
2020-10-21 14:38:28

Any pointers in the right direction would be appreciated! Also, any pointers as how to correctly set environment variables to use in test steps with World. I have used it in the past but I'm struggling a bit and not easily finding resources to explain it on the internet.

Adam Merritt
2020-10-21 16:29:52

@Adam Merritt has joined the channel

Adam Merritt
2020-10-21 16:30:01

Hi - (Working with major 7) I'm getting type error when returning a string 'skipped' , but the docs still say I can do this

[12:45 PM] is this a bug with the type? [12:46 PM] https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/step_definitions.md#skipped-steps

Aslak Hellesøy
2020-10-22 00:56:00

*Thread Reply:* @Adam Merritt can you please share the full stack trace?

Balazs Mandel
2020-10-22 03:15:16

Hi I have to click on a link that is always generated by the system and is always different, in the DOM is just a. <a href> any ideas on how to reach my goal what is clicking on the link?

Aslak Hellesøy
2020-10-22 03:54:38

*Thread Reply:* @Balazs Mandel add an id or class to it so you can identify it more easily. Or use XPath.

Balazs Mandel
2020-10-22 04:57:48

*Thread Reply:* @Aslak Hellesøy yeah that was the solution thanks !!!

Mona Ghassemi
2020-10-22 07:06:19

*Thread Reply:* That sounds like more of a webdriverIO question, not a cucumber question, but glad you got your answer!

Florent Bouisset
2020-10-23 01:45:38

@Florent Bouisset has joined the channel

Florent Bouisset
2020-10-23 01:56:29

Hello there! I'm searching for some help in cucumber-js, I recently upgrade from V5 to cucumber V7 to use the new feature of the tests reports. If I don't use the --publish option (to publish reports) it's working fine like before, but when I add it, I get an error at the end of the test, the error seem to come from a file in a node_modules. When I comment the code in that file, everything is working fine, no more errors, but it's not a pleasing solution because I have to comment that file every time I do a npm i .. Do you have any idea about how I can resolve that ?

Florent Bouisset
2020-10-23 01:58:28

*Thread Reply:* The error is that one: ``` scenarios (7 passed) 23 steps (23 passed) 0m20.580s (executing steps: 0m20.548s) events.js:109 throw new ERRINVALIDARG_TYPE('listener', 'Function', listener); ^

TypeError [ERRINVALIDARGTYPE]: The "listener" argument must be of type function. Received an instance of Object at checkListener (events.js:109:11) at ClientRequest.once (events.js:431:3) at new ClientRequest (httpclient.js:194:10) at Object.request (https.js:314:10) at Object.request (/home/florent/app/nodemodules/agent-base/patch-core.js:25:22) { code: 'ERRINVALIDARG_TYPE', CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ], } npm ERR! code ELIFECYCLE npm ERR! errno 1```

And the file I commented is patch-core in agent-base module

```'use strict'; const url = require('url'); const https = require('https');

/** * This currently needs to be applied to all Node.js versions * in order to determine if the req is an HTTP or HTTPS request. * * There is currently no PR attempting to move this property upstream. **/ // const patchMarker = "agentbasehttpsrequestpatched"; // if (!https.request[patchMarker]) { // https.request = (function(request) { // return function(options, cb) { // let options; // if (typeof _options === 'string') { // options = url.parse(options); // } else { // options = Object.assign({}, _options); // } // if (null == options.port) { // options.port = 443; // } // options.secureEndpoint = true; // return request.call(https, options, cb); // }; // })(https.request); // https.request[patchMarker] = true; // }

// /** // * This is needed for Node.js >= 9.0.0 to make sure https.get() uses the // * patched https.request(). // * // * Ref: https://github.com/nodejs/node/commit/5118f31 // **/ // https.get = function (url, _options, cb) { // let options; // if (typeof _url === 'string' && _options && typeof _options !== 'function') { // options = Object.assign({}, url.parse(url), options); // } else if (!options && !cb) { // options = _url; // } else if (!cb) { // options = _url; // cb = _options; // }

// const req = https.request(options, cb); // req.end(); // return req; // };```

luke
2020-10-23 02:07:45

*Thread Reply:* could you create an issue on cucumber-js with the info / file ref and a reproducible scenario.

Florent Bouisset
2020-10-23 02:20:24

*Thread Reply:* ok, I'll try to find a minimal reproducible example

Florent Bouisset
2020-10-23 03:55:09

*Thread Reply:* @luke I find a way to reproduce this with a minimal amount of code: clone: https://github.com/Florent-Bouisset/testCucumberReports.git npm install, and then run npm run cucumber => it should work then npm run cucumberReport => there is an error and the report is not published

luke
2020-10-23 04:02:56

*Thread Reply:* can you push that up to the issue tracker with the relevant links and we can take a look.

Florent Bouisset
2020-10-23 04:07:21

*Thread Reply:* Ok thanks I ll create an github issue then

Florent Bouisset
2020-10-23 04:20:13

*Thread Reply:* @luke before creating an issue I look if there was a problem with the tool puppeteer that I am using for doing e2e test, and I found out that if I upgrade puppeteer to the last version, I don't have the pblm anymore, so it's solved 😛 thx

Mona Ghassemi
2020-10-23 07:15:58

*Thread Reply:* Yes that's what I would have suggested first when you are getting such issues.

Mona Ghassemi
2020-10-23 07:16:09

*Thread Reply:* Upgrade your dependencies.

Mona Ghassemi
2020-10-23 07:16:10

*Thread Reply:* 🙂

Florent Bouisset
2020-10-23 08:14:36

*Thread Reply:* yes, they were not up to date because the new updates introduces breaking change that broke some parts of the app..

Mona Ghassemi
2020-10-23 09:08:19

*Thread Reply:* Yeah breaking changes are a whole project to fix 🙂

Aslak Hellesøy
2020-10-25 14:25:13

*Thread Reply:* So is this still a problem after upgrading @Florent Bouisset ?

Florent Bouisset
2020-10-28 01:43:38

*Thread Reply:* no it's fine thanks you

Jonas Amundsen
2020-10-24 11:44:50

I'm scratching my head here... How can null be compatible with ReadonlyArray?

Ali Katırcıo
2020-10-26 03:12:01

@Ali Katırcıo has joined the channel

Ali Katırcıo
2020-10-28 03:54:30

Hi, I want before run cucumber scenarios get this scenario steps and i have a test result json file, i will add step of running scenario into this json file but now i can't get steps, can you help me?

Erico K. L.
2020-10-28 10:28:23

@Erico K. L. has joined the channel

Erico K. L.
2020-10-28 10:36:25

Hi everyone..

Have someone else experiencing the --format snippet running more than once, depending on how many Examples are defined in the gherkin file?

Erico K. L.
2020-10-28 10:39:11

*Thread Reply:* To be more clear, I have a feature file like the following:

```Feature: Calculator

Scenario: Test Given I have number <n1> When I sum with <n2> or multiply by <n3> Then Result should be <result>

Examples:
  | n1 | n2 | n3 | result | 
  | 1  | 2  | 3  | 3      | 
  | 2  | 4  | 3  | 6      | ```
Erico K. L.
2020-10-28 10:41:53

*Thread Reply:* when I run cucumber-js --format snippets the result is two identical snippet for each sentence (because of the two executed scenarios)

Kārlis Amoliņš
2020-10-28 21:27:02

*Thread Reply:* It should be: Scenario Outline: not Scenario: Let me know if that helps. Ref: https://cucumber.io/docs/gherkin/reference/

Erico K. L.
2020-10-29 05:40:24

*Thread Reply:* I've already tried with Scenario Outline.. Same behaviour

Kārlis Amoliņš
2020-10-29 05:46:38

*Thread Reply:* What version of Cucumber are you using?

Erico K. L.
2020-10-29 07:31:43

*Thread Reply:* "@cucumber/cucumber": "^7.0.0-rc.0",

Kārlis Amoliņš
2020-10-29 18:51:01

*Thread Reply:* Hm, I can't really play around with it. I think Scenario Outlines are broken in that RC or at least, I can't get it to work as it doesn't recognise the Outline keyword.

But even on Master branch I am having issues with Scenario Outlines - though on master I get a different issue - the steps are not being recognised. 😞

Erico K. L.
2020-10-30 12:19:34

*Thread Reply:* Thanks @Kārlis Amoliņš.. so, should I create an issue on github?

Kārlis Amoliņš
2020-10-30 13:08:36

*Thread Reply:* Based on what someone else wrote - Outlines should be working so trying to make it work in a fresh repo, will let you know if that works - and if it does, will try to repro the issue you saw

Kārlis Amoliņš
2020-10-30 13:26:13

*Thread Reply:* I think I was somewhat off (misremembered what snippets does.

I think the behaviour you see is somewhat right. snippets print out definition for each undefined step.

So from the perspective of Cucumber it is doing what it should even though there is no practical benefit to it.

Erico K. L.
2020-10-30 14:04:18

*Thread Reply:* Yes, but maybe for the snippet generation purpose it would be very useful to produce just a single snippet per sentence

Aslak Hellesøy
2020-11-02 08:36:44

*Thread Reply:* @Kārlis Amoliņš Scenario is interchangeable with Scenario Outline since a while now...

Aslak Hellesøy
2020-11-02 08:37:25

*Thread Reply:* Not sure why you think Scenario Outline is broken?

Kārlis Amoliņš
2020-11-02 09:09:09

*Thread Reply:* @Aslak Hellesøy Hmmm, interesting.. Not sure why I was so convinced about them not being interchangeable. Thanks for pointing that out and apologies for spreading misinformation!

And I managed to get Scenario Outlines to work at a later point, I think my environment was messed up. 😓

👍 Aslak Hellesøy
Ali Katırcıo
2020-10-29 23:23:45

Hi everyone,

Ali Katırcıo
2020-10-29 23:26:05

Field f = scenario.getClass().getDeclaredField("testCase"); This is not useable anymore now cucumber with java and i want get scenario steps how can i use this with new cucumber version?

Kārlis Amoliņš
2020-10-30 05:17:28

*Thread Reply:* Hello. You should probably ask your question in <#C5YHPPJMP|help-cucumber-jvm> since it is Java specific

👍 Jo Laing
Ali Katırcıo
2020-10-30 06:24:45

*Thread Reply:* Ok, thank you.

Mike Cole
2020-10-30 12:39:32

@Mike Cole has joined the channel

Mike Cole
2020-10-30 12:40:37

Hi friends! I've posted an issue here: https://github.com/cucumber/cucumber-js/issues/1461 Does anyone have any workarounds?

Kārlis Amoliņš
2020-10-30 12:54:35

*Thread Reply:* Somewhat related question - are you able to run Scenario Outlines at all when using the RC?

Mike Cole
2020-10-30 13:01:41

*Thread Reply:* I'm not familiar with "RC"? But i'm currently able to run them.

Mike Cole
2020-10-30 13:04:24

*Thread Reply:* currently on npm 6.14.8

Kārlis Amoliņš
2020-10-30 13:05:04

*Thread Reply:* Apologies, by RC I meant Release Candidate (which is the latest released version of @cucumber/cucumber) and my question was, are you able to run Scenario outlines when using latest version of @cucumber/cucumber ?

Kārlis Amoliņš
2020-10-30 13:05:55

*Thread Reply:* I tried to assist someone earlier today/yesterday, but I couldn't get Scenario Outlines to work at all when using the latest version of cucumber 7.0.0-rc.0

Kārlis Amoliņš
2020-10-30 13:06:20

*Thread Reply:* Though, giving it another go right now

Mike Cole
2020-10-30 13:07:22

*Thread Reply:* yes, it is running the scenario outlines just fine.

Of course I needed to modify my step_defs to require @cucumber/cucumber instead of just cucumber

Mike Cole
2020-10-30 13:07:40

*Thread Reply:* the only problem is as stated above, it seems to have forgotten how to find overloaded functions

Kārlis Amoliņš
2020-10-30 13:09:03

*Thread Reply:* Gotcha, thanks for the information!

👽 Mike Cole
Kārlis Amoliņš
2020-10-30 13:11:12

*Thread Reply:* Out of curiosity, do you still have @types/cucumber in your repo?

Mike Cole
2020-10-30 13:12:41

*Thread Reply:* no I do not.

gürkan yarar
2020-11-01 22:03:04

@gürkan yarar has joined the channel

Md. Borhan Uddin Sarker
2020-11-05 00:56:27

Can anyone give me some test cases for ecommerce site

karamosky
2020-11-06 01:12:53

There is Sylius https://github.com/Sylius/Sylius/tree/master/features (this is written in PHP)

David Grayston
2020-11-07 11:51:05

@David Grayston has joined the channel

Lewis Cowles
2020-11-09 09:21:39

@Lewis Cowles has joined the channel

Sean Li
2020-11-10 00:58:00

@Sean Li has joined the channel

Richard Lawrence
2020-11-11 06:55:56

@Richard Lawrence has joined the channel

Andrew Irwin
2020-11-17 09:29:52

@Andrew Irwin has joined the channel

plocket
2020-11-17 14:19:35

I’m developing a package that uses cucumberjs. Right now, I’m having to bump the npm version every [time] I change anything, like when I fix a typo. I tried linking the package locally a while ago and got some error about world. Does someone know how to solve that so I can link locally instead of using npm as a go-between?

David Goss
2020-11-18 09:58:05

*Thread Reply:* Yeah, I think I know what this is.

When you npm link your library, you introduce a problem where your libary and the host project are using different instances of cucumber (each from their own node_modules dir) which causes failure.

There is a bit of info and some suggestions here https://github.com/cucumber/cucumber-js/issues/1146. My solution on a few projects has been to use the "import-cwd" package (https://www.npmjs.com/package/import-cwd), like this:

const importCwd = require("import-cwd"); const {Given, When, Then} = importCwd("cucumber"); That way even when linked you're always using the host project's cucumber-js instance and all should be well. Hope this helps.

vjrasane (https://github.com/vjrasane)
Comments
5
npm
plocket
2020-11-18 12:20:40

*Thread Reply:* Thanks, we’ll give it a shot

plocket
2020-11-18 12:48:16

When I use puppeteer to download a file, cucumber does not finish, it just hangs. I found this way to detect about when the the file will be downloaded, I don’t always want to close the browser when the download completes, I just want cucumber to be able to finish at the end. What are some resources that can point me in the right direction to solve this?

Stack Overflow
ANASTACIA WASHER
2020-11-23 07:54:12

@ANASTACIA WASHER has joined the channel

Roberto Zen
2020-11-24 04:59:01

@Roberto Zen has joined the channel

Roberto Zen
2020-11-24 05:19:29

Hi everybody ! I'm setting up a project with cucumber-js and typescript and I am facing some problems regarding the this as function context w.r.t the cucumber's World. Given the following world ```# world.ts import { World, setWorldConstructor } from 'cucumber';

function MyWorld(this: World) { this.worldParameter = 'hello'; }

setWorldConstructor(MyWorld); I defined a step_def.ts as follows: # step_def.ts import { Given, When, Then, World } from 'cucumber';

function foo(val: string): Promise<any> { const value = ${this.worldParameter}_${val}_${this.worldParameter}; console.log(value); return Promise.resolve('success'); }

Given(/^STEP WITH 1 PARAMETER$/, foo); This is not fine to Typescript because of [TSError: 'this' implicitly has type 'any' because it does not have a type annotation.ts(2683)] So, I added the `this: any` as first parameter of the foo function and it became like as follows: # step_def.ts import { Given, When, Then, World } from 'cucumber';

function foo(this: any, val: string): Promise<any> { const value = ${this.worldParameter}_${val}_${this.worldParameter}; console.log(value); return Promise.resolve('success'); }

Given(/^STEP WITH 1 PARAMETER$/, foo); This worked ! However, if I want to share `foo` code across many steps, I can write something like this: Given(/^STEP WITH 2 PARAMETERS$/, async function (val1: string, val2: string) { await foo(val1); await foo(val2); }); and here I face the problem with this parameter..I tried also to write it in different way, such as: Given(/^STEP WITH 2 PARAMETERS$/, async function (this: any, val1: string, val2: string) { await foo(this, val1); await foo(this, val2); });``` but it didn't work. Can anyone give me some hint please?

Mona Ghassemi
2020-11-24 08:42:59

*Thread Reply:* I'm just curious what packages are you using to run cucumber with ts? Last time I checked, I saw the ts cucumber package (not sure exactly what it was called but I can check) was still using old cucumber package (prior to the re-name) so I was not able to transition to ts at that time. I'd appreciate if you could share your package.json set-up.

Roberto Zen
2020-11-24 09:04:38

*Thread Reply:* Hi, sure, I'am using: "@types/cucumber": "6.0.1", "cucumber": "6.0.5", "ts-node": "9.0.0", my tsconfig is the following: { "compilerOptions": { "target": "ES2019", "module": "commonjs", "declaration": true, "sourceMap": true, "strict": true, "strictBindCallApply": false, "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "noUnusedLocals": false, "noUnusedParameters": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "strictPropertyInitialization": false } } and the script I use to execute cucumber is npx cucumber-js --require-module ts-node/register --require 'features/****/**.ts' features/****/**.feature

Mona Ghassemi
2020-11-24 11:12:22

*Thread Reply:* Ah, looks like indeed you are using a prior version of cucumber. We're using "@cucumber/cucumber": "^7.0.0-rc.0". Was excited about the reporting feature and this was a new project. I was first attempting the setup using this guide: https://dev.to/denolfe/cucumber-js-with-typescript-44cg and I believe it was indeed @types/cucumber that was using the old dependency, and it seems it has not been updated recently: https://www.npmjs.com/package/@types/cucumber 😞

DEV Community
npm
Mona Ghassemi
2020-11-24 11:12:50

*Thread Reply:* But I've also heard typescript is a lot of overhead as well so 🤷

David Goss
2020-11-24 07:41:37

Hey @Roberto Zen

I think you’re pretty close; there’s a couple of different ways you could solve it. When you add this: any as the first parameter to a function, it doesn’t actually end up being a parameter in the JS, it’s just compiler advice. So the structure of foo comes out as per your first example, with just one parameter. If you want to control what the value of this is within the function, you could change the way you call it to use Function.prototype.call , like this:

await foo.call(this, val1); Alternatively, you could leave your usage as it is, and make the world a normal parameter in your function - so rewrite it to something like:

function foo(world: any, val: string): Promise&lt;any&gt; { const value = `${world.worldParameter}_${val}_${world.worldParameter}`; console.log(value); return Promise.resolve('success'); } (I would argue that second one is a bit clearer, FWIW.)

Finally, for a different angle again, you could always make your World a class and make foo a method on it, so you can just call it from each step.

Hope this helps!

MDN Web Docs
Roberto Zen
2020-11-24 08:22:41

Hi @David Goss thank you for the reply. I tried the second solution you wrote, thus: function foo(world: any, val: string): Promise&lt;any&gt; { const value = `${world.worldParameter}_${val}_${world.worldParameter}`; console.log(value); return Promise.resolve('success'); } However, when I write Given(/^STEP WITH 1 PARAMETER$/, foo); I see that world is set to the parameter get from the step, while the val is a function (callback I immagine)

Roberto Zen
2020-11-24 08:24:05

Thus world becomes a real parameter, and it is no longer the cucumber's World

David Goss
2020-11-24 10:49:15

Ah sorry, I didn’t pick up originally that you want to use the function directly as a step function - I would say just:

Given(/^STEP WITH 1 PARAMETER$/, async function(this: any, val: string) { await foo(this, val); }); So your foo function becomes a utility but all the steps are still their own function literal.

Sébastien Poulet-Mathis
2020-11-26 05:50:00

@Sébastien Poulet-Mathis has joined the channel

vishu handa
2020-11-29 02:27:45

Did anybody made jar file using cucumber...

vishu handa
2020-11-29 02:29:11

Getting jar file issue.... that its not able to find features file in that

David Goss
2020-11-29 03:14:30

@vishu handa I think you want to post in <#C5YHPPJMP|help-cucumber-jvm>, this channel is for the JavaScript version

vishu handa
2020-11-29 03:15:17

Ok thnks chuddy buddy

Lewis Cowles
2020-11-30 05:36:16

Having blue murder with webdriverio and cucumber 😭

```Feature: Login

Scenario Outline: As a user, I recieve an error message when using invalid credentials to log into the application

Given I am on the login page
When I login with &lt;username&gt; and &lt;password&gt;
Then I should see an error message saying &lt;message&gt;

Examples:
  | username        | password         | message                      |
  | CD2 Team        | empty_string     | The password field is empty. |
  | empty_string    | 4y94hr4uejfhekj  | The username field is empty. |

Scenario: As a user, I can login

Given I am on the login page
When I login as an admin
Then I should be on the admin dashboard page```

The above works, but I get odd messages like

> [20200:20212:1130/132632.334:ERROR:deviceeventlogimpl.cc(211)] [13:26:32.333] USB: usbdevicehandlewin.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) Also the reporting I get is unexpected...

> Spec Files: 1 passed, 1 total (100% completed) in 00:00:15 The reporting I would like would be something more like a Jest test

``` PASS e2e/features/login.feature (25.59 s) As a user, I recieve an error message when using invalid credentials to log into the application √ Missing Username √ Missing Password As a user, I can login √ as an admin (28 ms)

Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 3 passed, 3 total Time: 32.38 s Ran all test suites.``` Does anyone know if there is something out-of-the-box that can pair webdriverio and cucumber with this type of reporting, silencing the noise?

David Goss
2020-11-30 05:49:21

Are you using a framework that wraps cucumber-js and webdriver?

Lewis Cowles
2020-11-30 07:11:39

I believe it's "@wdio/cucumber-framework" which according to my package lock file uses the official nodejs cucumber package

Lewis Cowles
2020-11-30 08:50:35

Right I got it...

npm install @wdio/dot-reporter --save-dev then add 'spec' to reporters

binarymist
2020-12-01 00:13:55

Hi All, I'm in the process of upgrading cucumber from 5.1.0 to 7.0.0-rc.0 and the cucumber.getTestCasesFromFilesystem routine seems to have been moved. Is there a new approach for getting the test cases from filesystem?

Chris Hiester
2020-12-02 15:09:45

@Chris Hiester has joined the channel

binarymist
2020-12-02 18:09:34

Opened issue here: https://github.com/cucumber/cucumber-js/issues/1489 around getTestCasesFromFilesystem Thanks for response @David Goss

binarymist (https://github.com/binarymist)
Comments
3
Jigar Soni
2020-12-03 11:23:12

@Jigar Soni has joined the channel

Jigar Soni
2020-12-03 19:58:14

Hello, Tool Details: Cypress Cucumber Chai multi-cucumber-report I am facing issue Feature file connection with StepDef. for example : Unable to user feature A’s stepDef into feature B.

Michael Hornstein
2020-12-05 07:43:08

@Michael Hornstein has joined the channel

Michael Hornstein
2020-12-06 07:36:25

Hi I’m using cucumber.js 7.0.0-rc.0 and I want to be able to filter out scenarios based on the availability of back-end data, that is very fluid in nature. With cucumber-jvm and TestNG I was able to setup a filter that removed individual scenarios based on the required data not being available prior to any scenarios being run. This worked perfectly and did not require and changes to cucumber-jvm of TestNG Now i’m trying to migrate this capability to a test framework built with cucumber.js and so far i have not found a solution that does not require any changes to cucumber code base.. Does anyone have any ideas about how i might be able to do this? Thanks in advance.

Lewis Cowles
2020-12-09 05:26:55

Hi Michael, would fixtures or dummy data that is always present not be the best way?

Michael Hornstein
2020-12-09 06:42:41

Hi @Lewis Cowles, My test framework running against a real systems and the resource i need is used by other groups within the enterprise. through their tests, the resource required sometimes gets clobbered or removed entirely. so my Java solution was to test for the data’s existence, and if it doesn’t exist, the framework removes the scenario/pickle before the tests start. I want to migrate this capability to my new typescript solution.

Lewis Cowles
2020-12-09 09:26:12

If it's functioning as a test and removal triggers a skip, it sounds like engineering in false confidence.

You do have the ability to run code before test suites, scenarios, steps, and I would likely change strategy to do that rather than conditionally skip.

It's up to you, but I'd seriously re-consider this approach, unless it's skipping features that are switched off, and even then, I'd suggests shipping / deploying those with the feature, rather than conditionally skipping.

Just an idea of how to approach alternatively.

Michael Hornstein
2020-12-09 09:51:15

@Lewis Cowles Thanks, I should add that the filter is driven by the first given step in each scenario. if the given fails, which is essentially the prerequisite to running a test scenario, i want to skip the test scenario entirely because the prerequisite failure is really a false failure, because nothing of interest can be tested or proven. so my solution is a pre-check for prerequisites, if that fails, skip the scenario.

cucumber-jvm in my java solution which removes scenarios (ie., cucumber collects all the tagged scenarios, and then the pre-check removes any where the prerequisites is not available), doesn’t even know anything was skipped at all. TestNg offers this public abstract class AbstractTestNGCucumberTests {} and it has this method which i wrap with my filter

exactly what i want. reports summarizes which prerequisites are missing. All this occurs before any tests are actually run.

Michael Hornstein
2020-12-09 09:53:18
Michael Hornstein
2020-12-09 09:55:32

handy little method to override

Michael Hornstein
2020-12-09 10:00:05

i’ve been exploring cucumber/lib/cli/index.js as a possible way to get the pickles and filter them. but it feels wrong.

Kelsey Mangnall
2020-12-10 10:31:11

@Kelsey Mangnall has joined the channel

Muha
2020-12-10 10:56:30

@Muha has joined the channel

Michael Hornstein
2020-12-11 05:11:04

Hi everyone, i’ve been looking for a way to dynamically skip an entire scenario . I worked out a cucumber-jvm approach that works perfectly, but for cucumber.js i’m at a loss. is there a way to do that? Thanks

luke
2020-12-11 05:26:05

so in ruby there is one as is in java. I imagine the same one must exist.

Inside your world (hooks), try doing something like skip_this_scenario I appreciate this is a guess. As I don't code the js one. But it definitely "should" exist. If it doesn't let us know.

If there's a way to dynamically get the available functions in js when you're in the hooks try dumping them to the console.

Michael Hornstein
2020-12-11 05:32:37

Thanks, i’ll give that a look, i explained my java solution on December 6th and 9th above, its based on how the TestNG runner class AbstractTestNGCucumberTest provides a list of scenarios.

Michael Hornstein
2020-12-11 09:10:45

@luke i see the skip_this_scenario in ruby, but nothing like that appears in javascript. it would be a nice feature. Thanks for the clues.

Michael Hornstein
2020-12-11 10:21:57

Hi everyone, i’ve looked at GherkinDocumentWalker from gherkin-utils to filter out a scenario based on availability of data. so i can see the scenario.gherkinDocument adjusted in the Before hook, but the scenario that i filter is still executed. is the GherkinDocumentWalker a suitable tool? i expect i haven’t used the filtered gherkinDocument properly, it looks like the filtering is too late. Has anybody out there experience with this, and who can tell me what i’m doing wrong? thanks

John Ringler
2020-12-11 17:01:59

@John Ringler has joined the channel

jradom
2020-12-12 12:36:35

I’m using Cypress/Cucumber/Typescript and looking for a reporter which can generate reports with attached screenshots, text, maybe some files, etc. Any help will be greatly appreciated

jradom
2020-12-13 22:21:39

Did anyone use Allure Cypress plugin to generate Cucumber?cypress reports. I’l looking for simple example because the one on the site is huge and not easy to follow. Any help will be greatly appreciated

Lewis Cowles
2020-12-15 02:50:42

*Thread Reply:* A SDET that attends a local meetup I attend shared https://github.com/thomaschaplin/webdriverio-template which got me down a few rabbit holes

Language
<p>JavaScript</p>
Last updated
<p>2 months ago</p>
Lewis Cowles
2020-12-15 02:51:17

*Thread Reply:* I would not follow their take on page objects

Krisztina Hirth
2020-12-16 10:42:06

@Krisztina Hirth has joined the channel

Krisztina Hirth
2020-12-16 10:42:13

Hi all 👋

Krisztina Hirth
2020-12-16 10:46:43

I am looking for some help for cucumber and jest. The context is: we write our api-specs with jest but still generate the nice cucumber HTML reports. There are 2 packages solving the test part but only one quite old version of one of them supports the reports.

Is this the right channel for this context?

jbpros
2020-12-17 07:25:06

*Thread Reply:* hey -- what is your question? 🙂

Krisztina Hirth
2020-12-17 10:16:48

*Thread Reply:* I am using jest-cucumber but it does not really supporting reporting. They had one version (one year old) which had the reporting included but the maintainer is not happy with it and haven't included it in any other version. Now I am stuck, cannot update and will wake up with security leaks 😞

Krisztina Hirth
2020-12-17 10:17:32

*Thread Reply:* so the question is if you have an idea how and with what I could write jest tests but have cucumber features and reports?

Krisztina Hirth
2020-12-17 10:18:44

*Thread Reply:* it could be mocha too, these are quite similar.

David Goss
2020-12-21 11:08:23

*Thread Reply:* Hi @Krisztina Hirth, I’d like to understand more about the motivation behind using jest-cucumber. Reading between the lines, it sounds like you aren’t that bothered about writing your specs in Gherkin - you write them in jest - but just want good reporting, is that fair?

With the release of cucumber-js 7.0.0 today, a run of cucumber generates standard messages that can be consumed by a formatter (including our own html formatter). So in theory you (or, the maintainer of jest-cucumber) could generate those messages from jest and use the same formatter - would be a bit of work involved but I could give some pointers.

Krisztina Hirth
2021-01-04 10:50:14

*Thread Reply:* Happy New Year everybody, sorry @David Goss for the silence, I had holiday and I had to reduce my amount of communication 🙂

Krisztina Hirth
2021-01-04 10:50:52

*Thread Reply:* After reading your question I realized that it was an error to not start with cucumber-js from the beginning on

Krisztina Hirth
2021-01-04 10:51:33

*Thread Reply:* I started to rewrite the tests today afternoon and I still would have a couple of questions:

Krisztina Hirth
2021-01-04 10:53:10

*Thread Reply:* The first one: is there a possibility to configure the call via a config object? My npm command is 2 rows long already 🙄

David Goss
2021-01-04 10:57:09

*Thread Reply:* yep you can define “profiles” in a cucumber.js file in your project, see https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#profiles

David Goss
2021-01-04 10:57:47

*Thread Reply:* simple example: https://github.com/davidjgoss/cucumber-puppeteer-typescript-starter/blob/master/cucumber.js

Krisztina Hirth
2021-01-04 10:58:08

*Thread Reply:* this is it, thank you!!!

Krisztina Hirth
2021-01-04 10:58:36

*Thread Reply:* an example like this would be very helpful in the docs

David Goss
2021-01-04 10:59:07

*Thread Reply:* agreed! i have a few things to do in the docs so will add that

Krisztina Hirth
2021-01-04 10:59:35

*Thread Reply:* Last question: I read that the JSON reports are deprecated

Krisztina Hirth
2021-01-04 10:59:49

*Thread Reply:* I still would like to generate the html reports

Krisztina Hirth
2021-01-04 11:00:18

*Thread Reply:* I tried the current format and it is cool but it can be nicer :)

Krisztina Hirth
2021-01-04 11:00:54

*Thread Reply:* Do you know the html-cucumber-reporter (or similar)?

David Goss
2021-01-04 11:01:21

*Thread Reply:* so that one and others use the (deprecated) JSON formatter output, is that what you mean?

Krisztina Hirth
2021-01-04 11:01:21

*Thread Reply:* This is what I use at the moment but it needs json as entry file.

David Goss
2021-01-04 11:01:28

*Thread Reply:* okay yeah

Krisztina Hirth
2021-01-04 11:01:51

*Thread Reply:* The question is: what is your recommendation to be used instead of json?

Krisztina Hirth
2021-01-04 11:02:52

*Thread Reply:* if you are not using it is ok, I will check tomorrow

David Goss
2021-01-04 11:02:59

*Thread Reply:* the JSON formatter is deprecated but wont be removed until 8.0.0 which is probably some way off, so it’s fine to use for now. the core team have also written libraries for converting between the JSON format and the new messages protocol, meaning formatters like that should be able to refactor so they can tae the new messages as input without much difficulty before 8.0.0

David Goss
2021-01-04 11:03:48

*Thread Reply:* in the meantime it would be good to get your feedback on the built in html formatter. it’s quite new but now the infrastructure is in place so i think it could be iterated on quite well

Krisztina Hirth
2021-01-04 11:04:15

*Thread Reply:* I think it is cool, much more informative as the old one 🙂

Krisztina Hirth
2021-01-04 11:04:40

*Thread Reply:* and I like that it is searchable 👍

👍 David Goss
Krisztina Hirth
2021-01-04 11:06:31

*Thread Reply:* I am on my private laptop now but tomorrow or the day after I will create some screenshots and then I can show you, what I'm missing if you would like :)

David Goss
2021-01-04 11:09:59

*Thread Reply:* that’d be great, thanks

👍 Krisztina Hirth
Krisztina Hirth
2021-01-06 09:47:44

*Thread Reply:* So, I'm back 🙂

I migrated almost all my tests (50 scenarios). Regarding the reports: this is how the html-report looks like (but maybe your know this already, it is shown here https://www.npmjs.com/package/cucumber-html-reporter)

Krisztina Hirth
2021-01-06 09:48:50

*Thread Reply:* I tried to use the ndjson-file but unfortunately didn't work:

⚠️ 😞 Unable to parse cucumberjs output into json: '%s' ./reports/cucumber.ndjson SyntaxError: ./reports/cucumber.ndjson: Unexpected token { in JSON at position 217

Krisztina Hirth
2021-01-06 09:49:21

*Thread Reply:* Question 1: I saw that you are using it. What are you doing with it?

Krisztina Hirth
2021-01-06 09:50:56

*Thread Reply:* The currently generated html report is not bad, as I already mentioned it it contains all the information

Krisztina Hirth
2021-01-06 09:51:42

*Thread Reply:* and this is the same error in the html-report

Krisztina Hirth
2021-01-06 09:57:32

*Thread Reply:* Generally there are a few differences: • in the cucumber-html-report the scenarios are displayed, the steps are collapsed, in 2 columns on the page • in the cucumber.js report the files are listed and collapsed if green. This means for me that in this case the report is not intended as a documentation but as a regression testing tool • the cucumber-html report has that nice pie chart showing the overview. This is really nice but it is surely more a nice2have

Krisztina Hirth
2021-01-06 09:58:47

*Thread Reply:* That's it regarding the reports. the cucumber-html-report is really nice and I will keep it until the json-format still exists but I will switch afterwards to the html-format.

Krisztina Hirth
2021-01-06 10:01:40

*Thread Reply:* Now to the CustomWorld: I tried it today but it didn't work. When calling this in another file it was an empty object. I tried different filenames but it didn't help. ```[11:46] // file world.js or CustomWorld.js

const { setWorldConstructor } = require('@cucumber/cucumber');

const props = { insuranceOption: null };

class CustomWorld { constructor() { this.variable = props; }

setInsuranceOption(option) {
    props.insuranceOption = option === 'add';
    this.variable = {
        ...props
    };
}

}

setWorldConstructor(CustomWorld);

// support file When(/^I choose to (add|not add) an additional travel insurance$/, async (option) => { console.log(this); this.setInsuranceOption(option); }); // error: TypeError: this.setInsuranceOption is not a function at CustomWorld.When (/home/``` What do I miss?

David Goss
2021-01-06 16:15:12

*Thread Reply:* > Question 1: I saw that you are using it. What are you doing with it? You mean what am I doing with the NDJSON? Those messages is used as the input to the built-in HTML formatter (internally the html formatter option just pipes them through directly to save you doing it). Long term the idea is that most/all formatters use those messages as the input, meaning they could be common across all cucumber implementations.

👍 Krisztina Hirth
David Goss
2021-01-06 16:19:25

*Thread Reply:* > the cucumber-html report has that nice pie chart showing the overview. This is really nice but it is surely more a nice2have Agree it's a nice to have, although the underlying desire for a ratio/percentage of pass:fail is interesting.

👍 Krisztina Hirth
David Goss
2021-01-06 16:20:52

*Thread Reply:* The way you've set your custom world up is fine (though you may want to take the options argument to the constructor and call super(options) with it, so that you still get the attach function etc.

David Goss
2021-01-06 16:24:13

*Thread Reply:* The problem is with the step definition - you have an arrow function there, but it needs to be a regular function literal instead, like:

When(/^I choose to (add|not add) an additional travel insurance$/, async function(option) { console.log(this); this.setInsuranceOption(option); }); (More about why here https://github.com/cucumber/cucumber-js/blob/master/docs/faq.md#the-world-instance-isnt-available-in-my-hooks-or-step-definitions.)

👍 Krisztina Hirth
Krisztina Hirth
2021-01-10 04:51:24

*Thread Reply:* I finished the migration and I am very satisfied (I ask myself why I even started with the jest-cucumber package 🤔 ) The custom world works very well too. Thanks a lot for your help!!

One last feedback to get an easier usability of the lib: I think a small hint or a few examples how to write the tests with chai.js would be helpful.

👍 David Goss
tracey
2020-12-17 07:22:54

@Krisztina Hirth Yes, it is! @jbpros may be able to help! ping

👋 jbpros
Krisztina Hirth
2020-12-17 10:10:29

~cool~ 🙂 ~Would you like to know what it is all about (should I write it here) or rather directly?~ solved :)

👍 tracey
plocket
2020-12-19 04:47:50

When I try to implement my own timeout (as described here) and the tests fail, the tests finish (I see how many scenarios passed and failed), but the process never exists. At least, it doesn’t exit with a rejection. I haven’t yet gotten a completely passed test. What am I doing wrong here: https://github.com/plocket/docassemble-cucumber/blob/var_table/lib/steps.js#L183

plocket
2020-12-19 06:04:55

*Thread Reply:* I think I’m mistaken. Sometimes it exits and sometimes it doesn’t. I haven’t yet figured out all the context, but I know that when the setTimeout rejects, the process does exit.

plocket
2020-12-19 07:04:01

*Thread Reply:* Wrong again - it does finish, it just… takes a heck of a long time…?

plocket
2020-12-19 07:57:19

*Thread Reply:* Solution: You have to clear the setTimeout

plocket
2020-12-20 06:26:43

How do I get World.attach? This is my world.js (from a tutorial):

plocket
2020-12-20 07:09:42

Does cucumber-js provide a default World that I can subclass from?

plocket
2020-12-20 07:17:40

For those who miss the obvious as much as I do, your custom world constructor can use attach, log, parameters:

plocket
2020-12-20 07:49:12

Welp, apparently attach isn’t great for reporting stuff in the log after the test has run. Never used a reporter before. Does someone have hints about how to log this stuff right after the test results have logged?

David Goss
2020-12-21 11:15:06

*Thread Reply:* log is now available in 7.0.0

That and attach are really about providing data to formatters. Do you just want to output something to the console?

plocket
2020-12-27 07:48:09

*Thread Reply:* Yes, to the console. People on our team, me included, find it really annoying to download files from github to see the report and we don’t have resources at the moment to set up some kind of reporting page.

plocket
2020-12-27 07:48:26

*Thread Reply:* Not sure what formatters are in this context.

David Goss
2021-01-04 10:55:25

*Thread Reply:* formatters are for building reports (or similar) with the output of a test run

David Goss
2021-01-04 10:55:50

*Thread Reply:* depending on how much and how big, you could just console.log

plocket
2021-01-04 15:53:54

*Thread Reply:* Thanks. We wanted it to appear after the cucumber test report, but that part isn’t that important, so maybe we’ll stick with console.log. A formatter might be a stretch goal.

👍 David Goss
plocket
2020-12-20 07:52:52

And apparently .log is just undefined

plocket
2020-12-20 08:13:31

I guess I want to report in some way, but I’d rather do it right there in the console…

plocket
2020-12-20 08:21:53

I tried attach in my After step anyway, to see if I could construct something useful and it didn’t do anything at all.

Aslak Hellesøy
2020-12-21 06:39:09

Cucumber.js 7.0.0 is out!!! • https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md#700-2020-12-21https://www.npmjs.com/package/@cucumber/cucumber

npm
🎉 tracey, sonja leaf, David Goss, Roberto Zen
🥒 sonja leaf, David Goss
sonja leaf
2020-12-21 10:06:12

*Thread Reply:* This is very exciting. Thanks for all the hard work!

❤️ Aslak Hellesøy
Adam Merritt
2020-12-21 08:26:33

i don't suppose the changes could cause cucumber to create/try to require an 'index.js' file in the cwd() ?

Our project doesn't have this file yet it's now throwing an error in the require stack

David Goss
2020-12-21 11:13:00

*Thread Reply:* Not something I’d expect, no - would you mind creating an issue under https://github.com/cucumber/cucumber-js/issues with some more details (ideally a little project where we can reproduce it) and I’ll take a look

Jim Trenowden
2020-12-24 04:00:09

@Jim Trenowden has joined the channel

T Nguyen
2021-01-02 12:02:07

@T Nguyen has joined the channel

Jim Trenowden
2021-01-04 01:50:54

Hi everyone! I’m having an issue with cucumber-js 7.0.0, where in both the new HTML reporter and the reports published to reports.cucumber.io I can’t attach a screenshot because I’m told the image isn’t base64 encoded.

The code I’m using is pretty much identical to the example given in the Cucumber docs: await driver.takeScreenshot().then(function (screenShot) { world.attach(screenShot, 'image/png') })

I previously used the third party cucumber-html-reporter to generate HTML reports and the above code works fine there. Does anyone know what I could be doing wrong?

David Goss
2021-01-06 16:42:10

*Thread Reply:* Sorry for the late reply @Jim Trenowden

I think the docs are at odds with the reality here. If you pass a buffer or stream as the data (first arg) it will be base64 encoded, but if you pass a string it will be assumed to be the content type you declare (i.e. not base64 encoded). That leaves us without a way to attach directly from webdriver at present since it's returning a base64 encoded string (as opposed to say puppeteer which will give you a buffer).

I'm going to raise on GitHub and try to get it addressed. In the meantime I think you could (kind of awkwardly) work around it by decoding the base64 string (I know), like:

await driver.takeScreenshot().then(function (screenShot) { world.attach(new Buffer(screenshot, 'base64'), 'image/png') })

Jim Trenowden
2021-01-14 00:51:25

*Thread Reply:* Sorry, just seen your reply. That’s very helpful, thanks. Good to know it’s not just me!

Royi Freifeld
2021-01-05 01:02:56

@Royi Freifeld has joined the channel

Royi Freifeld
2021-01-05 01:06:43

Sorry. I was posting in the wrong help channel so reposting here:

I’m using cucumber-js 7 with typescript, and I always get some unknown error: TypeError: Cannot read property 'line' of undefined at Object.parseTestCaseAttempt (&lt;long-path&gt;/node_modules/@cucumber/cucumber/src/formatter/helpers/test_case_attempt_parser.ts:149:67) Any idea what can be the issue?

David Goss
2021-01-06 16:11:05

*Thread Reply:* Are you using a custom formatter?

Are you able to link to a minimal repro somewhere public?

Damonpam
2021-01-08 06:54:02

Hello! one question regarding v7 migration... is it possible that now is mandatory to pass the this: World as a parameter of the step definition?

jbpros
2021-01-08 07:04:04

*Thread Reply:* it is not mandatory per se from a runtime perspective, but it is necessary to make the compiler happy if you access anything on this in your step definition (and you use typescript).

Damonpam
2021-01-08 07:10:26

*Thread Reply:* aham.. I see. I forgot to mention that Im using Typescript, yes. But in the the previous version it wasn't necessary...

Damonpam
2021-01-08 07:12:07

*Thread Reply:* i.e. I checked that example and it is defined

Damonpam
2021-01-08 07:12:33

*Thread Reply:* that is from the 7.0rc PR

jbpros
2021-01-08 07:29:12

*Thread Reply:* what do you mean by "it was not necessary"? do you get an error that was not there in previous versions, when you don't define it?

Damonpam
2021-01-08 07:32:37

*Thread Reply:* With the previous version if I didnt pass the this: World as a parameter it worked fine. I could use this.foo within the step definition without any problem.

But now, it says the following: error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. and When(/^the {string} foo bar tap$/, async function (type: string) { ~~~~~ An outer value of 'this' is shadowed by this container.

Damonpam
2021-01-08 07:33:41

*Thread Reply:* I gonna check if adding the parameter this: World it solves the issue

John Ringler
2021-01-08 15:10:34

Hello! This might have been answered earlier but does anyone know how I could store the output summary of a Cucumber run after all scenarios have been executed and store it into a variable?

41 scenarios (39 passed, 2 failed) 394 steps (367 passed, 25 skipped, 2 failed) 34m18.053s

luke
2021-01-11 02:50:33

do you mean the exit code>? Or specifically that string you've quoted there.

John Ringler
2021-01-11 09:43:24

*Thread Reply:* I mean the metrics from any test run (number of scenarios failed, passed, duration etc..)

luke
2021-01-12 07:20:35

*Thread Reply:* ah oki sorry. Good question I'm not 100% sure. I do know this kind of thing should be in the messages so if you're using the new-er versions it should be obtainable somehow.

David Goss
2021-01-14 00:16:40

*Thread Reply:* yeah we aggregate this from the standard messages emitted when cucumber runs

David Goss
2021-01-14 00:18:21

*Thread Reply:* if you look at the code for the summary formatter, you should be able to follow how it's doing it, and you could do something similar in a custom formatter

https://github.com/cucumber/cucumber-js/blob/master/src/formatter/summary_formatter.ts

Michael Morris
2021-01-18 07:23:36

@Michael Morris has joined the channel

Michael Morris
2021-01-19 06:27:57

Does anyone else think it would be useful to be able to pass additional arguments to setWorldConstructor(). This signature specifically: setWorldConstructor( class, args[]) An array of arguments to be passed to each new world instance.  Things like config arrays or the like which would otherwise need to be global.

👍 Krisztina Hirth
Tarfa Ali
2021-01-20 06:55:55

@Tarfa Ali has joined the channel

Sarah
2021-01-22 19:07:48

@Sarah has left the channel

Sarah
2021-01-22 19:07:53

@Sarah has joined the channel

Harsh Shah
2021-01-27 00:16:44

@Harsh Shah has joined the channel

goodahn
2021-01-27 07:03:59

@goodahn has joined the channel

goodahn
2021-01-27 07:07:11

Hello! I'm newbie to cucumber and js. Does anyone recommend the assertion package other than "assert"? Cucumber recommends the built-in "assert", however, I just wonder there exists more fitting package with Cucumber.

Mona Ghassemi
2021-01-27 07:24:55

*Thread Reply:* Chai is popular: https://www.chaijs.com/

chaijs.com
👍 goodahn
goodahn
2021-01-27 07:41:54

*Thread Reply:* @Mona Ghassemi Thank you for the recommendation!

Mona Ghassemi
2021-01-27 07:47:50

*Thread Reply:* no problem 🙂

Michael Morris
2021-01-27 08:24:52

*Thread Reply:* I also use Chai, but I'm testing webpages and I find that often it's useful to just keep retrying the action until the step times out. For example, if I expect to see a value in an element as the result of an ajax call it's more stable to repeatedly look at the element at 50 millisecond intervals to account for load lag than do a flat assertion.

Mona Ghassemi
2021-01-27 08:29:42

*Thread Reply:* Hmm, yes assertions can lead to some unwanted early fails. I learned about them a bit later in my automation journey and then wanted to use them everywhere, but now I know that in fact navigating to a page and finding an element actually counts as an (implicit) assertion (if you found what you were looking for, you're on the right page).

Mona Ghassemi
2021-01-27 08:30:33

*Thread Reply:* So yes, use them thoughtfully.

Michael Morris
2021-01-27 08:33:12

*Thread Reply:* At the end of the day, Cucumber is looking for a thrown and uncaught error and will stop the test when that happens. That's all that's really needed. It is often useful to catch Puppeteer/Selenium errors, which often have cryptic error message text, and rethrow them with a message that will be clear to whoever is reading Cucumber's test output.

Michael Morris
2021-01-27 08:33:51

*Thread Reply:* Assertion libraries are one way to do this very quickly, but not the only way.

goodahn
2021-01-27 16:46:33

*Thread Reply:* @Michael Morris Oh, yes. I also have experienced inconvenience in adding timeout to assertion with assertion libraries. Thank you! I need to consider it again.

Michael Morris
2021-01-27 08:22:12

Followup to the above - allowances would need to be made for command line parameters passed to world. setWorldConstructor( class, params, args[])

jradom
2021-01-27 08:40:33

Hello. I’m using cypress-cucumber-preprocessor and have issues/problems attaching on-demand screenshots to json report files in order to generate final HTML report. Can somebody suggest a solution?

David Goss
2021-01-27 10:09:18

*Thread Reply:* Can you post more detail about your issue? Maybe put the code up on GitHub?

jradom
2021-01-27 14:32:21

*Thread Reply:* @David Goss cypress-cucumber-prepocessor generates json report file and also screenshot of errors and on demand in a separate folder. You can the use Jenkins Cucumber plugin to see report with CSS added. There will be no screenshots attached to it unless you embed those screenshots into those json file(s)

jradom
2021-01-27 14:34:25

*Thread Reply:* well, I do use both from above. But I didn’t find a reliable solution to embed on-demand screenshots into json files

Edward Jezisek
2021-02-02 09:50:28

@Edward Jezisek has joined the channel

Michael Morris
2021-02-04 05:46:19

Is there any sort of cucumber blogging page were we can share things we've figured out?

tooky
2021-02-04 12:57:38

*Thread Reply:* @Jo Laing what’s the process these days for community blog contributions? Can you help Michael out?

tracey
2021-02-09 03:45:02

*Thread Reply:* @Michael Morris I don't know if we do that sort of thing anymore, but if you PM me what it is, maybe it's something I can include in the community newsletter.

Jo Laing
2021-02-24 07:39:20

*Thread Reply:* @Michael Morris Do you have the content ready in a doc? If so, you can post it in the <#C5YEEHG1E|recommended-media> channel for now and as Tracey mentioned above, it's maybe something we can include in the community newsletter too? I'd like to be able to offer up a place on cucumber.io for community blog contributions and have started looking at how to make that happen. Hope that helps a bit for now! 🙂

Michael Morris
2021-02-24 07:41:00

*Thread Reply:* I can certainly whip one up at some point.

Jo Laing
2021-02-24 07:41:20

*Thread Reply:* Great!

Michael Morris
2021-02-04 05:46:57

Specifically, I recently added an event emitter to my testing system since Cucumber.js doesn't ship with one to keep it's API consistent with the other languages.

Michael Morris
2021-02-04 05:47:25

It's not particularly complicated, but it might be useful.

luke
2021-02-04 05:47:43

there is a website where we do release blogs.

Michael Morris
2021-02-04 05:48:20

URL?

luke
2021-02-04 05:48:43

Some examples of them are: https://cucumber.io/blog/

cucumber.io
luke
2021-02-04 05:49:16

I personally think this one is the best one 🙂 https://cucumber.io/blog/open-source/tweaking-cucumber-rubys-auto-loader/

Cucumber.io
Michael Morris
2021-02-04 05:53:59

Cool. Yeah, the article I have in mind is in the same vein - but in this case leveraging Node.js' inbuilt EventEmitter class.

Michael Morris
2021-02-04 05:54:21

Great site btw.

Tally Barak
2021-02-04 23:03:38

@Tally Barak has joined the channel

Tally Barak
2021-02-05 05:44:04

hi, Using cucumber-js@7 with emitting messages, is there a way to generate the html report from multiple files and same format as it was with cucumber-html-formatter?

luke
2021-02-05 07:07:50

So as in you ran say job X generating messages I then you ....

ran job Y generating messages II ran job Z generating messages III

And now you want one report from messages [I,II,III]

?

Tally Barak
2021-02-05 09:00:23

*Thread Reply:* yes. I am running different jobs on ci and then I collect all outputs and would like to generate a single report. Works well with cucumber6

Michael Morris
2021-02-05 07:34:10

Can the --retry and --fail-fast flags be used together to get the test to fail if a scenario runs out of retries?

David Goss
2021-02-05 10:56:27

*Thread Reply:* Good question - we don't seem to have any coverage or documentation of the interplay between --retry and --fail-fast but I would say yes, I think if you have both it should exhaust the retry attempts for a scenario and then fail fast (as opposed to disregarding the retry).

Huckleberry
2021-02-11 04:37:13

Okay, so I have an automation repo that is using cucumberjs. My world.js file has gotten rather large and I’m trying to divide it up so it is easier to organize. I’ve tried to dividing into files and combining it via the prototype -

// features/support/world.js
const foo = require(‘./foo.js’);

class customWorldObject {
   bar(number) {
      //do stuff;
   }
}

customWorldObject.prototype.foo = foo;
setWorldConstructor(customWorldObject);

but later in in the step functions

// features/support/steps.js
const { Given, When, Then } = require(“@cucumber/cucumber”);
const assert = require(“assert”).strict;


When(“I increment the variable by {int}“, async function (number) {
  this.bar(number);
});

When(“the variable should blah blah blah”, async function() {
  this.foo();
});

When I run this puppy, it doesn’t seem the added function

TypeError: this.foo is not a function

So how can I correctly break the cucumberjs world object into separate files?

Michael Morris
2021-02-16 19:43:18

*Thread Reply:* I wrote this method for this problem. applyTraits: (klass, ...traitLibraries) =&gt; { for ( const traitLibrary of traitLibraries ) { const traits = require(paths.modules + "/traits/" + traitLibrary); for (const [trait, implementation] of Object.entries(traits)) { if (klass.prototype[trait]) { throw new Error('FATAL: Trait method ' + trait + ' already defined in the class.'); } klass.prototype[trait] = implementation; } } return klass; }

Michael Morris
2021-02-16 19:43:50

*Thread Reply:* It's a limited implementation of the Ruby notion of traits using the JavaScript prototypical inheritance.

Michael Morris
2021-02-16 19:45:30

*Thread Reply:* You would pass your World class as the first argument, and the rest of the function can be overloaded with library names. Here's a call to the function from my code: const Page = loader.applyTraits(loader.getClass("Page"), "Actions", "FormMethods", "WaitMethods", "UcxFields");

Michael Morris
2021-02-16 19:46:11

*Thread Reply:* Each trait library is simply an object of callbacks.

Michael Morris
2021-02-16 19:51:12

*Thread Reply:* Hmm.. Reading closer you're moving in the same direction as what I posted. What you have should work if the body of foo.js is this: module.exports = function() { //do stuff } HOWEVER!!! This will NOT work module.exports = () =&gt; { // do stufff } Arrow functions do not have a bindable scope, and bind does nothing to them. You can attach one to the world object, but it won't have access to this

Michael Morris
2021-02-16 19:53:39

*Thread Reply:* The method I posted above is looking for the trait libs to look like this: module.exports = { foo: async function () {}, moo: function () {}, bar: function (arg1, arg2) {} } And so on.

Michael Morris
2021-02-16 20:00:52

I've ran into a problem with Cucumber's current handling of multiple arguments, and I'm not sure there is a solution to it. I have these two step defs: defineStep(/I log in as an? (administrator|manager|read-only user)/, iFleetLogin); defineStep(/I log into an? (\w+) account as an? (administrator|manager|read-only user)/, loginCallback); The loginCallback is an async function. It needs to have an optional argument - and that's a major catch and monkey wrench

Michael Morris
2021-02-16 20:06:29

*Thread Reply:* This workaround works, but it's pesky defineStep(/I log in as an? (administrator|manager|read-only user)/, async function(permission) { await login.bind(this)(permission); });

luke
2021-02-17 01:00:50

*Thread Reply:* just place a ?

luke
2021-02-17 01:01:35

*Thread Reply:* ? after a capture or group means 0 or 1 of the preceding one. The same way as an? means the same as a(?:n)?

Royi Freifeld
2021-02-17 04:05:05

Hi Why are the tests running twice? ..FF..FF

luke
2021-02-17 06:10:06

it could be a failure in hooks as well as your scenario. I don't know without checking.

Reyjie Mesias
2021-02-17 19:53:36

Hi, are there anyone in here encountered stale element reference: element is not attached to the page document , I've been looking for a solution lately but got no luck.

luke
2021-02-18 05:54:06

as the name suggests, that is a browser automation failure caused by a stale element ref.

👍 Reyjie Mesias
luke
2021-02-18 05:54:46

an element reference changes when one of many things occur. Usually one of 3 things

Itself is mutated after being located It's parent or containing parents/frames are mutated after being located It has had a style change or cosmetic change which causes the element to be reloaded

Aurélien Reeves
2021-02-23 08:05:24

@Aurélien Reeves has joined the channel

Des Horsley
2021-02-23 14:45:03

Hello, i've just discovered the rule (https://cucumber.io/docs/gherkin/reference/#rule) keyword, the documentation seems to imply that it can be used in conjunction with the example keyword as a synonym for Scenario. When I try this locally and here https://cucumber.github.io/cucumber-js/ it doesn't seem to execute.

Would this example be incorrect: Feature: Simple maths Rule: My first rule Example: easy maths Given a variable set to 1 When I increment the variable by 1 Then the variable should contain 2 I saw that it says this is Gherkin 6, I can't find where cumberjs states the version of gherkin that it supports.

David Goss
2021-02-23 14:48:20

*Thread Reply:* What version of cucumber-js itself are you running locally?

Des Horsley
2021-02-23 14:48:48

*Thread Reply:* @David Goss 5

David Goss
2021-02-23 15:21:08

*Thread Reply:* Okay - Rule is supported from 7.0.0 onlyhttps://www.npmjs.com/package/@cucumber/cucumber

npm
Des Horsley
2021-02-23 15:29:12

*Thread Reply:* Right, thanks @David Goss looks like its still prerelease too: > 7.x.x and above > (Not yet released)

David Goss
2021-02-23 15:32:38

*Thread Reply:* Don't worry, there is a stable 7.0.0 out! Maybe a small hiccup in the release process there with that readme.

Des Horsley
2021-02-23 15:33:00

*Thread Reply:* Awesome, thanks

Des Horsley
2021-02-23 15:33:33

*Thread Reply:* I'll upgrade and see how I go, I think i'll need a new html reporter too

Aslak Hellesøy
2021-02-24 00:08:41

*Thread Reply:* @Des Horsley cucumber-js 7 has a new HTML formatter built-in

Des Horsley
2021-02-24 01:59:16

*Thread Reply:* Awesome, thank you

Deb Learns
2021-02-28 21:03:25

@Deb Learns has joined the channel

Chats
2021-02-28 21:57:44

@Chats has joined the channel

Deb Learns
2021-03-01 01:14:54

Hello, is there a decently comprehensive / real life project that uses cucumber (javascript)? That is also open sourced? I wanted to see an example of a comprehensive application of cucumber.

MarkSweetlove
2021-03-01 08:00:00

@MarkSweetlove has joined the channel

Chats
2021-03-01 20:25:58

Hi Community, ( using Cucumber JS ) I would need your help/expertise in finding the solution to my problem , " I want to pass the multiple test data in Examples ( with Json File Name as a normal String ) and i should be writing a code to read the Files and use the different set of test data for one function (e:g function login() -------------->>>>> Example of my test Scenario Outline: Sign in successful with post idm user - <service> Given I am a user with *<service> When I sign in with *valid credentials  And I close the tutorial screen  Then I am taken to the dashboard view Examples:  |service|  |a single prepay connection|  |a single Postpay connection|

Aslak Hellesøy
2021-03-03 04:24:26

*Thread Reply:* @Chats I'm not sure I understand what you're asking for.

Aslak Hellesøy
2021-03-03 04:24:54

*Thread Reply:* Do you want to load test data from an external file?

Chats
2021-03-03 04:27:46

*Thread Reply:* @Aslak Hellesøy Yes my external file (.json) in some folder and i wanna pass the file name as a string in examples ( jsut for readable purpose ) and i wanna write a logic where i can read the file by matching the string passed in examples of scenario and get the values of json

Chats
2021-03-03 04:28:49

*Thread Reply:* @Aslak Hellesøy I have a class written in Java which is a UserProfileReader class but i am struggling to implement it in Js

MarkSweetlove
2021-03-02 09:47:03

Hi everyone! In ruby there’s an AfterConfiguration hook that gives us the instance of Cucumber Configuration that contains information like the formatters specified and tags used for the test run. Is there an equivalent way to access that information from a hook in Cucumber JS?

Aslak Hellesøy
2021-03-02 09:49:03

*Thread Reply:* Hi @MarkSweetlove - I'm afraid there isn't. What do you need it for?

MarkSweetlove
2021-03-02 09:54:07

*Thread Reply:* In ruby it allowed us to add a custom formatter at runtime to avoid specifying it on the command line every time.

Aslak Hellesøy
2021-03-02 09:56:13

*Thread Reply:* @MarkSweetlove you can define common command-line options in a cucumber.js config file in your project root: https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#profiles

Aslak Hellesøy
2021-03-02 09:57:04

*Thread Reply:* Here is cucumber-js' own config: https://github.com/cucumber/cucumber-js/blob/master/cucumber.js

MarkSweetlove
2021-03-02 10:09:16

*Thread Reply:* On Ruby we could update the cucumber config from our own third party gem by registering the hooks which was ideal for our scenario, but doesn’t sound like that’s an approach we can take in JS.

Huck Carignan
2021-03-02 09:58:21

@Huck Carignan has joined the channel

Huck Carignan
2021-03-02 09:58:55

hi - has anyone started using the npm module @cucumber/cucumber?

Aslak Hellesøy
2021-03-02 09:59:38

I have, but I am one of the maintainers, so maybe that doesn't count 🙂

Aslak Hellesøy
2021-03-02 10:00:14

Happy to answer any specific questions you have about it

Huck Carignan
2021-03-02 10:23:15

OMG - great. so I was like on cucumber 5.1.0 and upgraded to 7.0.0

Huck Carignan
2021-03-02 10:23:27

when I run node ./node_modules/@cucumber/cucumber/bin/cucumber-js

Huck Carignan
2021-03-02 10:24:02

I'm told Cannot find module 'cucumber'

Huck Carignan
2021-03-02 10:24:35

how should I be running it? via the cucumber/bin/cucumber-hs ?

Huck Carignan
2021-03-02 10:34:53

to be clear, I can run more on the file:

Huck Carignan
2021-03-02 10:35:01

❯ more ./node_modules/@cucumber/cucumber/bin/cucumber-js #!/usr/bin/env node

require('../lib/cli/run.js').default();

Aslak Hellesøy
2021-03-02 10:49:23

@Huck Carignan have you followed the upgrade instructions? https://github.com/cucumber/cucumber-js/blob/master/docs/migration.md

Huck Carignan
2021-03-02 10:51:17

I did, but I'll run through them another time incase I missed a step

Huck Carignan
2021-03-02 10:51:25

I'll do that now

Aslak Hellesøy
2021-03-02 10:54:37

You should run node_modules/.bin/cucumber-js

Huck Carignan
2021-03-02 10:58:54

so I re-did the steps. Same issue

Huck Carignan
2021-03-02 10:59:39

I noticed that the node_modules/.bin/cucumber-js contains : require('../lib/cli/run.js').default();

Huck Carignan
2021-03-02 10:59:50

thats doesn't seem correct to me

Huck Carignan
2021-03-02 11:00:11

what do you have for node_modules/.bin/cucumber-js ?

Aslak Hellesøy
2021-03-02 11:10:53

I have the same as you in node_modules/.bin/cucumber-js :

```#!/usr/bin/env node

require('../lib/cli/run.js').default();``` What do you think is incorrect about it?

Aslak Hellesøy
2021-03-02 11:11:55

If you're still getting Cannot find module 'cucumber' then that's likely from some other code you have lying around that still tries to load the old cucumber module. Perhaps the stack trace will point you to what file that is?

Huck Carignan
2021-03-02 11:17:18

okay, I'll start hunting for a loose cucumber module

Aslak Hellesøy
2021-03-02 11:19:35

Does the stack trace not tell you what file is trying to load cucumber

Huck Carignan
2021-03-02 14:02:07

you were right - I found a hidden old cucumber reference - after that was removed, it ran

Huck Carignan
2021-03-02 14:02:27

but now it's ignoring my @tags on the feature files

Huck Carignan
2021-03-02 14:02:40

I'm going to look at the docs now

slackbot
2021-03-02 15:59:49

Bonjour! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Huck Carignan
2021-03-02 18:37:31

Quick shout out to Aslak. Thanks for your help earlier today 🙂

Aslak Hellesøy
2021-03-03 04:25:33

*Thread Reply:* Did you solve the problem @Huck Carignan?

Huck Carignan
2021-03-03 06:11:08

*Thread Reply:* I got it running, but I'm now having issues with the @tags. I believe it might be an issue with the formatter changes. I won't be able to investigate this for another few hours (other work priorities)

Huck Carignan
2021-03-03 06:11:16

*Thread Reply:* thanks for asking

Chats
2021-03-03 04:26:02

Hi @Aslak Hellesøy - I am trying to implement where i can pass just name of the json file without .json extension in examples and read this file by writing the logic behind it, is this achievable , or whats the best practice to pass multiple test data to one scenario through Json ?

Aslak Hellesøy
2021-03-03 04:31:35

*Thread Reply:* @Chats Just read the file in your step definition

Chats
2021-03-03 04:40:19

*Thread Reply:* @Aslak Hellesøy i want to have it dynamic , as json passed in examples of scenario will be the name ( |some file1| and few more files as well |some file 2| and these files are under some UserProfile folder ( somefile1.json,------> now i wanna write a code in js which which will pick that json file from UserProfile folder by replacing some file1 to somefile1.json and read the file and return the values which eventually i want to use it in functions.

Aslak Hellesøy
2021-03-03 04:49:24

*Thread Reply:* @Chats Can you write your step definition so it receives the base name of the JSON file as an argument?

Aslak Hellesøy
2021-03-03 04:51:01

*Thread Reply:* When you have done that, just use fs.readFile to read the contents of the JSON file.

Aslak Hellesøy
2021-03-03 05:07:22

*Thread Reply:* Will this work for you @Chats?

Chats
2021-03-03 05:41:15

*Thread Reply:* @Aslak Hellesøy, Thanks , I will try to implement this solution

Jim Trenowden
2021-03-03 07:11:06

Hi all, perhaps a bit of a weird scenario and there’s every possibility it’s something I’m doing that’s wrong, but I have built a lightweight Slack app that allows my team to execute our Cucumber tests remotely. This all worked fine in cucumber-js 6.x, but I get a strange error in 7.0.0.

I kick off the Cucumber run with: cucumber.Cli({ argv: process.argv, cwd: process.cwd(), stdout: process.stdout, }).run() And the first test run succeeds on 7.0.0. The second run however fails instantly with this:

Jim Trenowden
2021-03-03 07:11:06

```/node_modules/@cucumber/cucumber/lib/runtime/parallel/coordinator.js:56 this.supportCodeIdMap[id] = this.supportCodeLibrary.stepDefinitions[index].id; ^

TypeError: Cannot read property 'id' of undefined at /nodemodules/@cucumber/cucumber/lib/runtime/parallel/coordinator.js:56:88 at arrayEach (/nodemodules/@cucumber/cucumber/nodemodules/lodash/lodash.js:530:11) at Function.forEach (/nodemodules/@cucumber/cucumber/nodemodules/lodash/lodash.js:9410:14) at Coordinator.saveDefinitionIdMapping (/nodemodules/@cucumber/cucumber/lib/runtime/parallel/coordinator.js:55:26) at Coordinator.parseWorkerMessage (/nodemodules/@cucumber/cucumber/lib/runtime/parallel/coordinator.js:35:18) at ChildProcess.<anonymous> (/nodemodules/@cucumber/cucumber/lib/runtime/parallel/coordinator.js:88:18) at ChildProcess.emit (events.js:315:20) at emit (internal/childprocess.js:903:12) at processTicksAndRejections (internal/process/taskqueues.js:81:21) { CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ], CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ] } % events.js:292 throw er; // Unhandled 'error' event ^

Error [ERRIPCCHANNELCLOSED]: Channel closed at process.target.send (internal/childprocess.js:705:16) Emitted 'error' event on process instance at: at internal/childprocess.js:709:35 at processTicksAndRejections (internal/process/taskqueues.js:75:11) { code: 'ERRIPCCHANNEL_CLOSED', } events.js:292 throw er; // Unhandled 'error' event ^

Error: write EPIPE at process.target.send (internal/childprocess.js:832:20) at process.target.send (internal/childprocess.js:703:19) Emitted 'error' event on process instance at: at internal/childprocess.js:836:39 at processTicksAndRejections (internal/process/task_queues.js:75:11) { errno: -32, code: 'EPIPE', syscall: 'write', CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ], } events.js:292 throw er; // Unhandled 'error' event ^

Error: write EPIPE at process.target.send (internal/childprocess.js:832:20) at process.target.send (internal/childprocess.js:703:19) Emitted 'error' event on process instance at: at internal/childprocess.js:836:39 at processTicksAndRejections (internal/process/task_queues.js:75:11) { errno: -32, code: 'EPIPE', syscall: 'write', CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ], } events.js:292 throw er; // Unhandled 'error' event ^

Error: write EPIPE at process.target.send (internal/childprocess.js:832:20) at process.target.send (internal/childprocess.js:703:19) Emitted 'error' event on process instance at: at internal/childprocess.js:836:39 at processTicksAndRejections (internal/process/task_queues.js:75:11) { errno: -32, code: 'EPIPE', syscall: 'write', CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {}, CallSite {} ], }``` I’m completely lost to be honest, as I say this all worked fine with identical code on 6.x. Any ideas?

Jim Trenowden
2021-03-03 07:12:28

*Thread Reply:* Expected Slack to collapse that 😬

luke
2021-03-03 07:59:31

*Thread Reply:* So the error code is very declarative. It's telling you your fetch is failing on the index. So before you do anything else. Debug the line before execution and return the 1d-array in both versions. Triage from there.

Aslak Hellesøy
2021-03-03 14:36:21

*Thread Reply:* Looks like index is out of bounds, or the array has undefined values (less likely). Something might be wrong in coordinator.ts. BTW we need source maps to get better stack traces. Any idea @charlierudolph @David Goss ?

David Goss
2021-03-05 00:46:25

*Thread Reply:* Here's the line of code https://github.com/cucumber/cucumber-js/blob/master/src/runtime/parallel/coordinator.ts#L108

David Goss
2021-03-05 00:47:41

*Thread Reply:* Seems to suggest the coordinator and worker don't have the same information about the step definitions somehow.

Aslak Hellesøy
2021-03-05 00:48:27

*Thread Reply:* @Jim Trenowden would you be able to share something that would help us reproduce this?

David Goss
2021-03-05 00:48:34

*Thread Reply:* I'm not super familiar with this area so first step is to reproduce. @Jim Trenowden would it be practical for you to post your project to github (or an edited versin of it)?

David Goss
2021-03-05 00:48:43

*Thread Reply:* haha sorry

Aslak Hellesøy
2021-03-05 00:48:51

*Thread Reply:* hehehe

David Goss
2021-03-05 00:49:43

*Thread Reply:* @Aslak Hellesøy we do ship source maps in the package, but not the actual TypeScript source files, which explains that. I'll do a PR for that soon.

👍 Aslak Hellesøy
Jim Trenowden
2021-03-05 02:25:13

*Thread Reply:* Thanks for looking into this! It’s a huge project at my workplace so not really practical to share it (not my IP strictly speaking, even though I wrote it), but the file calling the Cucumber CLI looks like this if that’s helpful?

```const cucumber = require('@cucumber/cucumber')

async function cucumberRunner(tags, scenarioPath, parallel, jsonPath) {

const argv = process.argv const cucumberArgs = argv.concat( '--parallel', parallel, '--tags', tags, '--format', json:${jsonPath}, scenarioPath )

return await new cucumber.Cli({ argv: cucumberArgs, cwd: process.cwd(), stdout: process.stdout, }).run() }

module.exports = { cucumberRunner }```

Aslak Hellesøy
2021-03-05 02:28:04

*Thread Reply:* Thanks @Jim Trenowden I must admit I'm not at all familiar with the parallel implementation. But I know enough about parallelism that it's difficult to implement without concurrency bugs!

Jim Trenowden
2021-03-05 02:30:24

*Thread Reply:* i’ve noticed that if I knock the parallel threads down to 1 the first run of tests still passes fine, but in the second one the steps are undefined

It’s worth noting that the app that calls the above file is a Node.JS app that stays alive inbetween test runs if that makes a difference

Aslak Hellesøy
2021-03-05 02:33:15

*Thread Reply:* Hmm. Perhaps we have some sticky state somewhere that prevents Cucumber from running properly more than once in the same Node process?

David Goss
2021-03-05 02:39:01

*Thread Reply:* Yes I think that may be the case.

David Goss
2021-03-05 02:40:56

*Thread Reply:* Possibly related: https://github.com/cucumber/cucumber-js/issues/1278#issuecomment-580603152

charlierudolph (https://github.com/charlierudolph)
David Goss
2021-03-05 04:01:59

*Thread Reply:* Source maps fix is here https://github.com/cucumber/cucumber-js/pull/1607

davidjgoss (https://github.com/davidjgoss)
Labels
🔧 build
Comments
1
Jim Trenowden
2021-03-05 04:16:35

*Thread Reply:* Ah interesting, yeah issue 1278 does sound similar to what I’m seeing. Glad it’s not just me then!

Jim Trenowden
2021-03-05 04:17:37

*Thread Reply:* Although it’s weird that this only started happening in v7, in v6 this all works absolutely fine

Jim Trenowden
2021-03-05 05:17:11

*Thread Reply:* So clearing the Cucumber module cache between runs seems to “resolve” this, seems a bit hacky but it’s unblocked me at least. Thanks!

Michael Morris
2021-03-09 06:31:34

Is there any way to start cucumber from another js file? Cause my package.json is getting nightmarish "test-allstar": "./node_modules/.bin/cucumber-js ./tests/features ./tests/themes/allstar/features --require ./tests/init.js --require ./tests/steps --require ./tests/themes/allstar/steps --publish-quiet", "test-allstar-v2": "./node_modules/.bin/cucumber-js ./tests/features ./tests/themes/allstar-v2/features --require ./tests/init.js --require ./tests/steps --require ./tests/themes/allstar-v2/steps --publish-quiet", "test-ifleet": "./node_modules/.bin/cucumber-js ./tests/features ./tests/themes/ifleet/features --require ./tests/init.js --require ./tests/steps --require ./tests/themes/ifleet/steps --publish-quiet", "test-sme": "./node_modules/.bin/cucumber-js ./tests/features ./tests/themes/sme/features --require ./tests/init.js --require ./tests/steps --require ./tests/themes/sme/steps --publish-quiet",

Michael Morris
2021-03-09 06:32:37

*Thread Reply:* The exact feature sets to be tested depend on the brand theme in use, and the step definitions change as well based on this.

Aslak Hellesøy
2021-03-09 06:33:10

*Thread Reply:* npm adds ./node_modules/.bin/ to the PATH so no need to add that.

You can also execute arbitrary commands from npm scripts so just extract to a shell script

Michael Morris
2021-03-09 06:34:05

*Thread Reply:* That's not what I'm asking. Look at the god-awful argument list being passed to cucumber - that's what I'm asking about please - how to get rid of that.

Aslak Hellesøy
2021-03-09 06:34:13

*Thread Reply:* I also recommend adding common cucumber options in cucumber.js - see https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#profiles

Michael Morris
2021-03-09 06:34:57

*Thread Reply:* Profiles will help.

Aslak Hellesøy
2021-03-09 06:35:09

*Thread Reply:* Here is cucumber-js' own config: https://github.com/cucumber/cucumber-js/blob/master/cucumber.js

Michael Morris
2021-03-09 06:35:45

*Thread Reply:* But I still need to start a hugo webserver and an express.js server, preferably before Cucumber does anything.

Aslak Hellesøy
2021-03-09 06:36:50

*Thread Reply:* My preference is to do that in a Before hook

Michael Morris
2021-03-09 06:37:18

*Thread Reply:* BeforeAll, but yeah

Aslak Hellesøy
2021-03-09 06:38:11

*Thread Reply:* No, my preference is really to do it in a Before hook. That way I have less of a chance having server state accidentally leaking between scenarios

Aslak Hellesøy
2021-03-09 06:38:24

*Thread Reply:* (I shut the server down in After )

Michael Morris
2021-03-09 06:40:26

*Thread Reply:* That would add 2 minutes to all scenarios and cause the tests to run for 4 hours. So, no.

Michael Morris
2021-03-09 06:41:34

*Thread Reply:* Besides, in my case that's an unwarranted concern. I'm testing static javascript files built by Hugo, not a webserver that carries any sort of state.

Aslak Hellesøy
2021-03-09 06:42:01

*Thread Reply:* Yeah, if you have no state I agree BeforeAll is better.

Michael Morris
2021-03-09 06:42:37

*Thread Reply:* I do use a Before hook to force a reset of the Express server though.

Aslak Hellesøy
2021-03-09 06:42:49

*Thread Reply:* Did I manage to answer your questions?

Michael Morris
2021-03-09 06:43:04

*Thread Reply:* But that thing comes up in microseconds as opposed to a full minute or two.

Michael Morris
2021-03-09 06:43:17

*Thread Reply:* Yeah, this will help a lot. I'm reading the profile information now.

👍 Aslak Hellesøy
Michael Morris
2021-03-09 06:43:56

*Thread Reply:* Even though it wasn't the question I asked, I didn't realize ./node_modules/.bin was on path so that does help.

Michael Morris
2021-03-09 06:44:22

*Thread Reply:* Thank you for your time and I'm sorry if I came across as snippy - I've been dealing with a really weird and frustrating bug this morning.

Aslak Hellesøy
2021-03-09 06:45:11

*Thread Reply:* No worries - kill that bug!

Michael Morris
2021-03-09 06:53:45

*Thread Reply:* Is the current profile exposed to the tests?

Michael Morris
2021-03-09 09:54:58

Played around with profiles this morning. Seems sorta useless because I can't declare different feature sets with it - just different command line flags. What am I missing?

Aslak Hellesøy
2021-03-10 03:48:41

How many different feature sets do you want to define @Michael Morris? I've always used tags to differentiate between sets, and I have never found the need to enumerate what feature files to execute.

Why do you need this?

Michael Morris
2021-03-10 04:46:59

*Thread Reply:* I have a core application, and currently three brands. The brands have their own features, and the core specifications have different step definitions. I could use tagging as you describe and keep the features in one folder, but I'd have to write skip logic to skip tests belonging to brands other than the current one.

Michael Morris
2021-03-10 04:49:30

*Thread Reply:* I've built a test runner that starts cucumber off as a child process. It also goes ahead and starts the Hugo Web Server and Express.js Mock server, and stops them when the Cucumber process fires its exit event. The approach will work, though I wish I had an easy way to relay command line flags to Cucumber.

matt-SmartBear
2021-03-10 16:18:23

*Thread Reply:* @Michael Morris I dunno if this will help in your context, but I worked on a set of feature files the BBC had to specify a TV app that was run on lots of different TV’s “browsers” and a Flash-based set-top-box. We used the same set of feature files to test each TV, but tagged out scenarios that were not supported / applicable on some platforms. e.g. @not-samsung-tn482

You might find it’s more manageable to have all the specifications in one place and just tag out the discrepancies.

Michael Morris
2021-03-10 16:27:59

*Thread Reply:* I'm facing something very similar actually. One of the reasons that I'm wanting to keep the features in two directories is we are considering putting the brand themes off into their own repository modules. That would require their features stay with the rest of the code.

Michael Morris
2021-03-10 16:28:36

*Thread Reply:* I was tagging them earlier though and I didn't remove the code supporting it - @theme=ifleetfor example.

Huck Carignan
2021-03-11 06:49:40

Question: I used to run features with @tags, i.e.-  In the feature file, I have:   @New   Feature: 300 Manual Workflow with Group Approval turn off

In my package.json, I have:  "scripts": {   "test": ".node ./node_modules/.bin/cucumber-js --tags @New"

David Goss
2021-03-11 07:24:43

*Thread Reply:* Tags should be working as before. Can you elaborate on what you’re seeing?

Huck Carignan
2021-03-11 07:26:25

*Thread Reply:* yea, I was just about to edit my above question so that is clearer. 🙂

Huck Carignan
2021-03-11 07:27:50

*Thread Reply:* That was working fine on the original cucumber-js module

Huck Carignan
2021-03-11 07:27:59

*Thread Reply:* erm...package

Huck Carignan
2021-03-11 07:28:24

*Thread Reply:* basically now, ALL feature files get run

Jim Trenowden
2021-03-11 09:29:14

*Thread Reply:* Weird question, but are you using any particular formatters? I've noticed issues with tags and the progress-bar formatter in v7

Huck Carignan
2021-03-11 10:48:11

*Thread Reply:* I do

Jim Trenowden
2021-03-11 10:49:36

*Thread Reply:* So I've had to stop using the progress-bar formatter as I've noticed that it will sometimes ignore the tags provided and run all scenarios in the feature path

Jim Trenowden
2021-03-11 10:50:52

*Thread Reply:* Whereas not using that formatter seems to make everything behave as expected in v7

Jim Trenowden
2021-03-11 10:51:05

*Thread Reply:* Haven't tested other formatters to see if they have the same issue

David Goss
2021-03-11 10:51:17

*Thread Reply:* sounds like we're referring to https://github.com/cucumber/cucumber-js/issues/1579

Florent-Bouisset (https://github.com/Florent-Bouisset)
Labels
🐛 bug
Comments
3
David Goss
2021-03-11 10:52:03

*Thread Reply:* which is a bug where the progress bar formatter incorrectly reports the total number of steps (not accounting for the tag filter)

David Goss
2021-03-11 10:52:15

*Thread Reply:* but the formatter can't influence what's run or not run

Jim Trenowden
2021-03-11 10:52:22

*Thread Reply:* Ah-ha! Yes, knew I wouldn't be the first to spot this. Good to know it's been raised

David Goss
2021-03-11 10:52:51

*Thread Reply:* so i think it's likely that your tag expression is working (only the scenarios you wanted are run) but it just doesn't look that way from the output

David Goss
2021-03-11 10:53:06

*Thread Reply:* (i'm looking at how to fix this currently)

Huck Carignan
2021-03-11 12:16:26

*Thread Reply:* wha?

Huck Carignan
2021-03-11 12:18:28

*Thread Reply:* so run it without the progress-bar?

David Goss
2021-03-11 12:28:30

*Thread Reply:* Run it with or without - the progress bar is just misreporting

Huck Carignan
2021-03-11 12:30:22

*Thread Reply:* I'm trying now without the progress bar to see what happens

Huck Carignan
2021-03-11 12:37:04

*Thread Reply:* Yup, I believe you gentlemen are correct. Just a bug with the progress bar - not the test cases being run

👍 David Goss, Aslak Hellesøy
Olivierodo
2021-03-11 23:32:48

@Olivierodo has joined the channel

Umamaheswaran TG
2021-03-16 20:03:42

@Umamaheswaran TG has joined the channel

Matthias Rapp
2021-03-23 11:03:10

@Matthias Rapp has joined the channel

Michael Morris
2021-03-27 23:02:14

It would be nice if steps BeforeAll and AfterAll could see the worldParameters. I can work around the fact that they can't, but it's annoying.

Michael Morris
2021-03-27 23:03:45

*Thread Reply:* Specifically, I need both of them to see the browser configuration that I pass in as world params. When I have the headless mode of puppeteer turned off I want to leave the browser running when the test concludes. This allows the developer to interact with it after the test to work on things.

Michael Morris
2021-03-27 23:05:52

*Thread Reply:* My current work around is to put Before, BeforeAll and AfterAll in the same file. The browserConfig is a variable all these closures can see. Before inits the browser once only since BeforeAll can't without the config. AfterAll then looks at that var to determine if it's turning off the browser.

David Goss
2021-03-28 05:51:15

*Thread Reply:* This may happen soon-ish, see https://github.com/cucumber/cucumber-js/issues/1393

But also, would generally recommend an instance of puppeteer per test (world) rather than sharing one across the whole test run. Ensures segregation between tests and allows for running in parallel.

alexkaufman06 (https://github.com/alexkaufman06)
Labels
⚡ enhancement
Comments
10
👍 matt-SmartBear
luke
2021-03-29 01:28:32

*Thread Reply:* As mentioned, there are things that would be nice to share in the world in beforeall /afterall. But each beforeall / afterall currently spins up a new world instance so it's a bit intractable>

Also as David said, definitely don't share browser state. Should tear up / tear down the browser

plocket
2021-03-29 15:24:05

Is there a resource about how to convert from cucmberjs to @cucumber/cucumberjs? I’m getting Cannot set property 'World' of undefined now that I’ve updated.

plocket
2021-03-29 15:25:08

~I actually would prefer to not switch, but elements aren’t getting clicked, even though they are getting found and they are scrolled into view.~ I’ve gone crazy. This is a puppeteer problem, not a cucumber problem.

David Goss
2021-03-30 01:00:07

For reference anyway, there's a migration guide here https://github.com/cucumber/cucumber-js/blob/master/docs/migration.md - feedback welcome

Guru
2021-03-30 11:24:29

@Guru has joined the channel

Arindam
2021-04-09 01:12:13

@Arindam has joined the channel

Humphrey O' Mahony
2021-04-09 12:21:05

@Humphrey O' Mahony has joined the channel

MarkSweetlove
2021-04-12 06:49:33

Is there any way to retrieve the number of tests that are about to be executed in either the beforeAll hook or the testRunStarted event in a formatter? I’d love to be able to report the percentage of the test run that is complete after a scenario but i can’t find the information… I can get all the features/scenarios in the project from the gherkinDocument but not which ones are actually going to be executed based on the path or tag selection specified by the user.

matt-SmartBear
2021-04-12 10:01:41

*Thread Reply:* I’m afraid I’m not familiar enough with the code these days to know. @David Goss should know.

David Goss
2021-04-12 10:47:43

*Thread Reply:* Hey @MarkSweetlove, we do have a bit of a gap here. There is a testCase message which is effectively what you want - only emitted for a compiled scenario that is going to actually run - but at the moment the testCase message is emitted just before that test case executes. To have an accurate progress indicator we need to emit them all upfront before any tests execute - I'm actually working on this now under https://github.com/cucumber/cucumber-js/issues/1408, because I need it to solve https://github.com/cucumber/cucumber-js/issues/1579 at which point the progress bar formatter should serve as a good reference point for your use case. Please go ahead and watch those issues and hopefully this will be resolved pretty soon.

MarkSweetlove
2021-04-12 11:07:22

*Thread Reply:* Thanks David. Appreciate your response and I’ll watch those issues excitedly!

👍 David Goss
Manish Cheruku
2021-04-14 03:21:19

@Manish Cheruku has joined the channel

SJrX
2021-04-16 15:39:49

How do I pass command line arguments to cucumber? Like there is this concept of world parameters, but since the world is per test, I can't do anything with those parameters in a before all or after all.

David Goss
2021-04-16 23:13:52

*Thread Reply:* We’re going to make world parameters available to BeforeAll and AfterAll hooks soon, see https://github.com/cucumber/cucumber-js/issues/1393

Labels
⚡ enhancement
Comments
10
SJrX
2021-04-18 08:49:41

*Thread Reply:* thanks

Tim Yao
2021-04-20 16:23:23

@Tim Yao has joined the channel

Tim Yao
2021-04-20 16:25:34

Is anyone using lint tool for Gherkin scripts in the feature file? I am setup a new project and would like to add it so everyone in the team can follow the same rules. Currently I am looking at https://github.com/vsiakka/gherkin-lint which I think is what I can find the most popular one?

David Goss
2021-04-20 18:06:18

*Thread Reply:* I’ve used that and found it good

Tim Yao
2021-04-20 22:04:50

*Thread Reply:* Thanks @David Goss for your comments!

David Goss
2021-04-21 14:10:14

*Thread Reply:* There's also https://github.com/darrinholst/eslint-plugin-cucumber for linting your step code, if that might be useful to you.

Tim Yao
2021-04-21 16:10:00

*Thread Reply:* Good to know! Thanks @David Goss!

Tally Barak
2021-04-21 03:35:40

Is anyone else experience Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/formatter/helpers' is not defined by "exports" in /Users/me/dev/cucumber-playwright/node_modules/@cucumber/cucumber/package.json with the new 7.2.0?

Aurélien Reeves
2021-04-21 05:14:15

*Thread Reply:* It seems to be related to the following issue: https://github.com/cucumber/cucumber-js/issues/1646

David Goss
2021-04-21 06:08:42

*Thread Reply:* yep - think we'll need to revert and then publish a 7.2.1 so we can regroup - i'll do that today

👍 Aurélien Reeves
David Goss
2021-04-21 14:06:53

*Thread Reply:* @Tally Barak 7.2.1 is out which should unblock you - sorry about that!

bentaieb ameni
2021-04-22 04:16:00

@bentaieb ameni has joined the channel

Adam Elamrani
2021-04-22 08:53:57

@Adam Elamrani has joined the channel

Deb Learns
2021-04-25 22:33:06

does anybody know how I can get rid of this error when I reference a property from world.js (property… does not exist on type…):

Aslak Hellesøy
2021-04-26 01:05:41

*Thread Reply:* This looks like a warning from eslint. Does the code execute as expected @Deb Learns?

👍 David Goss
Deb Learns
2021-04-26 03:32:30

*Thread Reply:* it does execute correctly

Aslak Hellesøy
2021-04-26 03:39:04

*Thread Reply:* Good, not sure how to get rid of that warning though.

David Goss
2021-04-26 12:14:13

*Thread Reply:* Yeah the linter has no way of knowing that cucumber-js is going to bind the world to that function internally - a bit of a non-deterministic rule on that basis really. You could consider disabling that rule for your step_definitions specifically.

David Goss
2021-04-26 12:18:01

*Thread Reply:* If you feel like using TypeScript for your step definitions, you can then tell the compiler what this will be, see https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters

typescriptlang.org
Deb Learns
2021-04-27 01:52:28

*Thread Reply:* okay - thank you!

Mason Ham
2021-04-27 06:30:03

@Mason Ham has joined the channel

Zoe N
2021-04-28 11:21:24

@Zoe N has joined the channel

Tim Yao
2021-04-29 23:47:27

Does any one know anything for rerun/retry a failed Scenario ? The reason is I have some Scenarios reply on unstable integration. If a server return 500 error temporally which failed the scenario, I want to rerun the Scenario automatically.

Tim Yao
2021-04-29 23:50:31

I only see a formatter called rerun , it then need another cucumber run to rerun which I feel a little different with what I am expecting.

Aurélien Reeves
2021-04-30 00:21:22

*Thread Reply:* Hello 🙂

Here's the .feature file for the rerun formatter: https://github.com/cucumber/cucumber-js/blob/1109951440833c7f074b04d1b294e96ff1be65eb/features/rerun_formatter.feature

The idea is to use that formatter to output failures in a specific file which will then be used as an argument to a second execution of cucumber.

Tim Yao
2021-04-30 00:24:39

*Thread Reply:* Thanks @Aurélien Reeves! I was thinking another way to retry automatically multiple times without reporting. But maybe report it and run it failed one again is better approach. 🤔

😁 Aurélien Reeves
Aslak Hellesøy
2021-04-30 03:32:38

*Thread Reply:* @Tim Yao https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#retry-failing-tests

Tim Yao
2021-05-01 16:48:29

*Thread Reply:* @Aslak Hellesøy That’s what exactly I am looking for! Thanks! Will try it Monday.

Gem
2021-04-30 10:01:35

@Gem has left the channel

plocket
2021-05-02 13:10:59

The cucumber data tables print with all the columns lined up. How do I make sure the columns don’t try to line up? I’ve got some column values that are very long and it makes the already long table much longer.

Aslak Hellesøy
2021-05-02 13:48:21

*Thread Reply:* @plocket there is no way to do this currently. I suggest you use column values with a custom toString() method. Or, you could open an issue where we could discuss adding a feature that lets you control table formatting.

plocket
2021-05-02 13:49:46

*Thread Reply:* I’m not sure how/where I’d use a custom toString() method on column values, but I do know how to make an issue. Thank you.

Aslak Hellesøy
2021-05-02 13:51:08

*Thread Reply:* I forgot that in JavaScript you cannot control the type of table cells (you can in Java). See you in the ticket.

👍 plocket
ec-mark
2021-05-06 06:53:51

Hi folks, not sure if this is a bug or I'm doing something wrong. I'm trying to migrate from v6 to v7, and I can't quite get my custom formatter to work again. After following some v7 formatter examples, I have code like this: ```import { Formatter, formatterHelpers } from "@cucumber/cucumber" import { IFormatterOptions } from "@cucumber/cucumber/lib/formatter" import { messages } from "@cucumber/messages" import IEnvelope = messages.IEnvelope

export default class CustomFormatter extends Formatter {

constructor(options: IFormatterOptions) {
    super(options)

    options.eventBroadcaster.on("envelope", (envelope: IEnvelope) =&gt; {

        if (envelope.testStepStarted != null) {
            if (envelope.testStepStarted.testCaseStartedId == null) { return }
            try {
                const testCaseAttempt = options.eventDataCollector.getTestCaseAttempt(envelope.testStepStarted.testCaseStartedId)
                const parsed = formatterHelpers.parseTestCaseAttempt({
                    cwd: this.cwd,
                    snippetBuilder: this.snippetBuilder,
                    supportCodeLibrary: this.supportCodeLibrary,
                    testCaseAttempt,
                })
                <a href="http://console.info">console.info</a>(parsed)
            } catch (error) {
                console.error(error.message)
            }
        }
    ...```

And for every step, it throws on const parsed = formatterhelpers.parseTestCaseAttempt({ ... "Cannot read property 'status' of undefined" "TypeError: Cannot read property 'status' of undefined at parseStep (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/formatter/helpers/test_case_attempt_parser.js:55:24) at /Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/formatter/helpers/test_case_attempt_parser.js:93:28 at arrayEach (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/node_modules/lodash/lodash.js:530:11) at Function.forEach (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/node_modules/lodash/lodash.js:9410:14) at Object.parseTestCaseAttempt (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/formatter/helpers/test_case_attempt_parser.js:80:22) at EventEmitter.&lt;anonymous&gt; (/Users/me/Git/MyProject/packages/server/build/E2eTest/formatters/CustomFormatter.js:23:64) at EventEmitter.emit (events.js:327:22) at EventEmitter.emit (domain.js:486:12) at PickleRunner.aroundTestStep (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/runtime/pickle_runner.js:165:31) at PickleRunner.run (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/runtime/pickle_runner.js:206:28) at Runtime.runPickle (/Users/me/Git/MyProject/node_modules/@cucumber/cucumber/lib/runtime/index.js:83:43) at tryCatcher (/Users/me/Git/MyProject/node_modules/bluebird/js/release/util.js:16:23) at Object.gotValue (/Users/me/Git/MyProject/node_modules/bluebird/js/release/reduce.js:166:18) at Object.gotAccum (/Users/me/Git/MyProject/node_modules/bluebird/js/release/reduce.js:155:25) at Object.tryCatcher (/Users/me/Git/MyProject/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/me/Git/MyProject/node_modules/bluebird/js/release/promise.js:547:31)"

ec-mark
2021-05-06 08:33:49

*Thread Reply:* Also strange, is that the same basic logic works perfectly fine when the scenario ends: if (envelope.testCaseFinished != null) { if (envelope.testCaseFinished.testCaseStartedId == null) { return } const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(envelope.testCaseFinished.testCaseStartedId) const parsed = formatterHelpers.parseTestCaseAttempt({ cwd: this.cwd, snippetBuilder: this.snippetBuilder, supportCodeLibrary: this.supportCodeLibrary, testCaseAttempt, }) <a href="http://console.info">console.info</a>(parsed) } this is not throwing any errors

matt-SmartBear
2021-05-06 10:11:26

*Thread Reply:* I don't know the code, but I've had a look. It seems like the error you're getting is probably thrown from here:

https://github.com/cucumber/cucumber-js/blob/v7.2.1/src/formatter/helpers/test_case_attempt_parser.ts#L116 (I guess the line numbers are different in the typescript source?)

If that's true, this suggests the testStepResult is undefined in that function.

That function's called here: https://github.com/cucumber/cucumber-js/blob/v7.2.1/src/formatter/helpers/test_case_attempt_parser.ts#L169

and the line above it that sets the testStepResult is here: https://github.com/cucumber/cucumber-js/blob/v7.2.1/src/formatter/helpers/test_case_attempt_parser.ts#L157

So it seems like the code is assuming that every one of the testSteps will have a corresponding entry in the stepResults map, and that this isn't the case here?

It seems like this is a bug; I wonder if you could add some debugging into the cucumber source code on your machine to see if we can pinpoint what's wrong?

Nrs
2021-05-07 10:11:33

@Nrs has joined the channel

Caline Patriota
2021-05-12 05:24:42

@Caline Patriota has joined the channel

Jim Trenowden
2021-05-13 03:26:20

Hi all, is there a way to attach custom metadata to Cucumber messages (with the aim to add them to the HTML report)? Using cucumber-js 7.2.1

David Goss
2021-05-13 03:51:20

*Thread Reply:* Anything you attach from a step will come up in the report (long as it's in some displayable form). Are you able to say more about what you want to show and how?

Jim Trenowden
2021-05-13 04:00:26

*Thread Reply:* Sure, so previously I was using the cucumber-html-reporter package for our reports, and that allowed us to attach custom metadata to the “top” of the report that related to the whole test run, rather than a specific step or scenario.

Some of the metadata we were adding is at the top of the new HTML reports already, such as duration, OS, Node JS version etc. But we were also attaching things such as the feature path and tag combination that was used to kick off the test run, test environment, browser (as we’re using Cucumber to kick off Selenium tests) etc.

The data at the top of the new HTML reports seems to be coming from the meta object in the message formatter, if there was an easy way to inject custom metadata in there that would be great

Aslak Hellesøy
2021-05-13 06:23:31

*Thread Reply:* Can you give an example (in JSON) of what you'd like to attach, and how you'd like it to be displayed?

Kit Peters
2021-05-17 07:49:09

@Kit Peters has joined the channel

Kit Peters
2021-05-17 08:16:30

I'm developing an application to check a number of different websites using Selenium. I'd like to specify the "up" or "down" criteria for each website as a Cucumber Scenario (one scenario per site). The application is going to run periodically and write its results to a database, and will be hosted in AWS Lambda.

What I want to know is how do I write the code that processes the individual steps of each Scenario? In other words: • where do I define the functions that process the individual steps, e.g. Given, When, etc.? • How do I pass the statements comprising each Scenario to those functions? • How do I get the result of processing each Scenario? In more concrete terms, given this function definition: function handler() { const sites = getSitesToTest(); # array of strings for (const site of sites) { const statements = getStatements(site); # array of strings ok = processStatements(statements); # returns Boolean writeToDatabase(site, ok) } } How do I define processStatements()?

Kit Peters
2021-05-17 08:18:45

The docs seem fairly clear on how to write the individual Given(...), When(...), functions. It's tying those functions (and Cucumber in general) into my application that I'm having trouble with.

EDIT: See my previous message for the context this message should be read in.

Aurélien Reeves
2021-05-18 00:01:36

*Thread Reply:* Hello @Kit Peters 🙂

Here's a simple example of an app and its cucumber tests: https://github.com/cucumber-ltd/shouty.js

As you can see in https://github.com/cucumber-ltd/shouty.js/blob/master/features/step_definitions/shout_steps.js, it requires the code from your app, and uses the function as you would do with any module

Will that help?

Stars
3
Language
JavaScript
Kit Peters
2021-05-18 07:27:03

*Thread Reply:* "shouty" I like the name. 😄

😁 Aurélien Reeves
Kit Peters
2021-05-18 07:27:08

*Thread Reply:* I'll look it over now

Kit Peters
2021-05-18 07:58:47

*Thread Reply:* @Aurélien Reeves I'm sorry, I wasn't clear. The message at the root of this thread follows on from the message before it. I don't need to know how to write a standard test using Cucumber; there are numerous good examples (such as yours) of that. What I need to know is how, at a functional level, to process a user-defined scenario using Cucumber and get the result of that processing in a variable that I can then write to a database.

Aurélien Reeves
2021-05-18 08:03:16

*Thread Reply:* You want to implement your own cucumber ?

Kit Peters
2021-05-18 08:05:45

*Thread Reply:* I'm not sure I understand. Let me state it another way. I want a function that takes a scenario in the form of an array of strings and returns a boolean indicating whether or not the scenario was successful.

Kit Peters
2021-05-18 08:08:38

*Thread Reply:* I'm trying to use Cucumber in an application context, not a test context.

Aurélien Reeves
2021-05-18 08:09:20

*Thread Reply:* Why would you need the scenario in the form of an array of strings ?

Beside that, I would say that what you are looking for is a custom formatter. You can take a look here to take a look on how to build your own formatter : https://github.com/cucumber/cucumber-js/blob/main/docs/custom_formatters.md

Kit Peters
2021-05-18 08:10:12

*Thread Reply:* I need the scenario in the form of an array of strings because the scenario will be supplied by the user. I will not be defining the scenario beforehand.

Kit Peters
2021-05-18 08:10:46

*Thread Reply:* And the custom formatter doesn't help me get my scenarios into Cucumber in the first place.

Kit Peters
2021-05-18 08:11:27

*Thread Reply:* I have an idea that might help explain what I'm trying to do.

Kit Peters
2021-05-18 08:12:41

*Thread Reply:* Suppose I were to write a command line application that would allow the user to input their own scenarios via the keyboard. How would I send the user input to Cucumber?

Aurélien Reeves
2021-05-18 10:06:40

*Thread Reply:* Ok, I understand now 😛

Right now I do not have the time to go into much details. I will look deeper tomorrow.

I think what need to be done is: • generate a feature from those string arrays • parse it with gherkin: https://github.com/cucumber/common/tree/master/gherkin/javascript • run the resulting pickels with the cucumber-js runner: https://github.com/cucumber/cucumber-js/tree/main/src/runtime • then use a dedicated formatter for the post process of the results It is actually not trivial, I am not sure we have an API that would make that process easier, but I still do not know that much the API 😛

Maybe @David Goss or @charlierudolph would have better ideas?

Kit Peters
2021-05-18 10:07:57

*Thread Reply:* I've been speaking with @David Goss in another thread, but he hasn't responded to my last message. I haven't spoken with @charlierudolph.

Kit Peters
2021-05-18 10:10:42

*Thread Reply:* Those steps look very close to what I'm trying to accomplish.

sebastien.mangot
2021-05-18 02:58:40

@sebastien.mangot has joined the channel

Vinoth Kumar Sevagamurthy
2021-05-19 21:13:10

@Vinoth Kumar Sevagamurthy has joined the channel

M.E. Copas
2021-05-20 13:25:26

@M.E. Copas has joined the channel

Angelo Huaraca
2021-05-20 22:29:54

@Angelo Huaraca has joined the channel

Jonathan Coombs
2021-05-21 11:52:35

We have a service that will analyze the json output (using the cucumber-json-formatter tool) and have noticed that when we upgraded to use the cucumber-7 version the format of the URI of a feature in the ndjson file now has a prefix of the current directory. Is there a way to turn this off and revert back to not include that value? Previously we were seeing something like: "uri":"features/Compare/AddProviderToCompare.feature","id":"add_providers_to_compare","keyword":"Feature" and now we are seeing "uri":"/cucumber/features/Compare/AddProviderToCompare.feature","id":"add_providers_to_compare","keyword":"Feature" notice the addition of the prefix of /cucumber/ to the uri. We are NOT seeing this same format using cucumber ruby and would like to be able to have consistency between the two outputs.

Again, does anyone know of a way to turn off this additional content to the uri for features?

matt-SmartBear
2021-05-21 14:36:59

*Thread Reply:* Sounds like a bug to me

Jonathan Coombs
2021-05-21 14:37:53

*Thread Reply:* To clarify, a bug in the cucumber js logic in writing out the messages to cucumber.ndjson?

matt-SmartBear
2021-05-21 14:38:23

*Thread Reply:* Yes, as I understand it we have duplicated formatters in each of the cucumbers that write out this JSON format.

It's a long weekend in Europe, so might be best to raise an issue on cucumber-js so this doesn't fall through the net.

David Goss
2021-05-21 15:04:36

*Thread Reply:* I think this is https://github.com/cucumber/cucumber-js/issues/1534

Assignees
davidjgoss
Labels
🐛 bug, since-7
David Goss
2021-05-21 15:06:39

*Thread Reply:* Last change to fix this will land next week (depends on https://github.com/cucumber/cucumber-js/pull/1645 but nearly there)

Labels
🏦 debt, 🥒 core team, ⚡ enhancement
Comments
5
Jonathan Coombs
2021-05-21 15:07:48

*Thread Reply:* Yes, that sounds like the issue, thank you. I will check back in after that lands.

Jonathan Coombs
2021-06-01 11:00:17

*Thread Reply:* @David Goss, when do you think this fix will be released?

SantoshK
2021-05-25 15:34:58

@SantoshK has joined the channel

SantoshK
2021-05-25 15:36:12

Does cypress-cucumber-preprocessor works with plugin/index.ts typescript file?

SantoshK
2021-05-25 15:36:53

my feature file is not recognised if I am writing preprocessor code in plugin/index.ts

Aslak Hellesøy
2021-05-26 00:59:11

*Thread Reply:* That plugin is not supported by us. I suggest you ask the authors of the plugin @SantoshK

SantoshK
2021-05-26 03:52:28

*Thread Reply:* Thanks @Aslak Hellesøy

Tim Yao
2021-05-25 20:55:20

Any one know the best way to handle error in BeforeAll hook? Is below the right way? Or there is a better way? BeforeAll(async () =&gt; { if (//something wrong) { throw new Error('Something is wrong'); } }

Aslak Hellesøy
2021-05-26 00:57:13

*Thread Reply:* If a hook fails to do what it needs to do, it’s best to throw an error as you have suggested.

Tim Yao
2021-05-26 01:40:42

*Thread Reply:* Thanks @Aslak Hellesøy!

Michael Stelly
2021-05-26 10:21:56

@Michael Stelly has joined the channel

Michael Stelly
2021-05-26 12:52:00

I'm looking for a decent updated javascript walkthrough. I found one from 2018 that has not been updated since.

Aslak Hellesøy
2021-05-26 14:33:16

*Thread Reply:* @Michael Stelly this one is pretty good: https://turriate.com/articles/modern-javascript-everything-you-missed-over-10-years

Michael Stelly
2021-05-27 05:49:51

*Thread Reply:* Oops. I meant cucumber-js. Sorry I wasn't clear.

Michael Stelly
2021-05-27 05:50:37

*Thread Reply:* Although that's a handy reference nonetheless. 👍

Aslak Hellesøy
2021-05-27 05:57:21

*Thread Reply:* @Michael Stelly the change log is probably the best place to look.

https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md

✅ Michael Stelly
Michael Stelly
2021-05-27 06:14:25

*Thread Reply:* Let me rephrase: I'm looking for a current guided walkthrough to help me understand the workflow for cucumber similar to this 3-year old blog post http://www.thinkcode.se/blog/2018/02/07/getting-started-with-cucumber-for-javascript.

Michael Stelly
2021-05-27 06:17:24

*Thread Reply:* I found the example file in the repo. That should help to get me started.

👍 Aslak Hellesøy
Chats
2021-05-26 14:59:20

Hi Folks, I need some help, how to run multiple examples in the scenario outline without login all the time for each example, so in short, i want to login once and want to test all the multiple examples in my scenario, is it possible to run each row once without repeating all the steps again for all the rows ?

matt-SmartBear
2021-05-26 15:31:38

*Thread Reply:* Yes, it's possible.

Cucumber scenarios (whether they come from regular scenarios or examples in a scenario outline table) are intended to be independent, to avoid the anti-pattern. So doing what you're suggesting is not recommended. However, if logging in is slow, and you have no options to do all this other than via the browser, it may be the pragmatic choice.

Given this, here are your options:

  1. Ignore our advice, and add a "Log in" scenario at the top of your feature file. Always run the scenarios in order so this one runs first.
  2. Add a tagged hook that ensures your session is logged in. Add the tag to each of your scenarios that need the user to be logged in. Make the code in the hook clever enough to check first whether the user is logged in, and only do the login if necessary.
  3. Do something similar to (2) in an explicit Given step instead of a hook.
Chats
2021-05-26 17:21:59

*Thread Reply:* Thanks @matt-SmartBear

luke
2021-05-27 02:16:56

*Thread Reply:* So we have this situation. And I would advocate a fourth option - But it's not test architecture, it's software architecture. (Matt also would probably push for this irl).

If the logging in isn't something you care about testing, and it's something which is causing a pain point in terms of test execution and it's either not directly your system, or a system you are confident in it's existing functionality, then adding a bypass or backend is advised.

luke
2021-05-27 02:17:20

*Thread Reply:* at CA we have to login using a different website currently then redirect and pass a cookie, so we just artificially generate this. It removes 99% of the logging in time.

slackbot
2021-05-26 14:59:20

Bonjour! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Michael Stelly
2021-05-27 06:52:24

Where would I find the cucumber.js file described here? To disable this message, add this to your ./cucumber.js: │ module.exports = { default: '--publish-quiet' }

Aslak Hellesøy
2021-05-27 06:53:34

You just create it in your project's root directory. Documented here: https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#profiles

Michael Stelly
2021-05-27 06:57:25

*Thread Reply:* ahh Thank you. I didn't know it was a custom config file. I assumed it was something already created.

Michael Stelly
2021-05-27 06:58:10

*Thread Reply:* I appreciate the help during my learning curve. I'll be sure to pay it forward.

Aslak Hellesøy
2021-05-27 06:58:24

*Thread Reply:* Just keep asking 🙂

🤓 Michael Stelly
Michael Stelly
2021-05-28 06:10:43

Ah ha! I found the Cucumber School tutorials. They didn't exist my last go round. For the record, anyone landing here with questions such as those I had, all those answers are found in the first few modules of that free training. Well done, folks!

matt-SmartBear
2021-05-28 07:33:46

*Thread Reply:* Great, glad you're liking them. Please post any feedback directly to the team in <#CCK3ZFSF9|school-devs> - we're still working on the last few episodes.

🙌 Michael Stelly
Michael Stelly
2021-05-28 06:12:38

So, don your thinking caps, grab a pickle, get some schoolin'! Cucumber School 🎓

🎉 matt-SmartBear
:dancing_pickle: matt-SmartBear
Aslak Hellesøy
2021-05-28 06:27:46

:face_palm: not sure why I forgot to recommend that!

Vincent Couturier
2021-05-30 10:01:22

@Vincent Couturier has joined the channel

binarymist
2021-05-31 02:43:51

Has anyone used the new(ish) @cucumber/gherkin-streams package? I've been having some trouble requiring it: https://github.com/cucumber/cucumber-js/issues/1675

Aurélien Reeves
2021-05-31 03:15:46

*Thread Reply:* Crosspost:

If you try something like the following, does it work? ```const { GherkinStreams } = require('@cucumber/gherkin-streams')

const stream = GherkinStreams.fromPaths(/.../)``` If so, it seems to be an error in the documentation

binarymist
2021-05-31 04:07:00

*Thread Reply:* I'll check

binarymist
2021-05-31 04:18:46

*Thread Reply:* That was it @Aurélien Reeves, thanks.

binarymist
2021-05-31 05:24:25

Does anyone have any insight into this comment (https://github.com/cucumber/cucumber-js/issues/1489#issuecomment-820716265) around getting test cases from the file system? Also do you have an update on this 6 month old issue (@Aslak Hellesøy) I still haven't been able to resolve? If so a response on the issue would be much appreciated 🙂

Aurélien Reeves
2021-05-31 08:20:26

*Thread Reply:* What is your issue at the moment?

binarymist
2021-06-01 21:07:04

*Thread Reply:* Issue updated @Aurélien Reeves and thanks muchly for your eye balls and grey matter on it!

binarymist
2021-06-11 20:09:39

*Thread Reply:* Issue updated @Aurélien Reeves

Aurélien Reeves
2021-06-13 23:30:37

*Thread Reply:* 👍

As soon as I have a couple hours to take a look on it, I'll do

binarymist
2021-06-24 17:32:26

*Thread Reply:* I'd expect with the "minimal reproducible example" you requested it should be minutes rather than hours @Aurélien Reeves? Thanks.

Michael Stelly
2021-06-01 06:31:31

Hi all. How do I get my test output to display the passing test details as seen in the Cucumber School videos? All I get are the results like this: 4 scenarios (4 passed) 17 steps (17 passed) 0m00.019s (executing steps: 0m00.007s) Done in 2.71s. In the videos, I see that sometimes mocha is executed. Is all I need to do is run jest on the files (I don't use mocha)?

Michael Stelly
2021-06-01 06:35:24

I think I found it. I would have to set up a separate test collection as those found in /tests. That's overkill for the tutorial, but good to know as I move toward integrating Cucumber into my project.

David Goss
2021-06-01 06:39:03

What kind of detail do you want to output? The pretty formatter might be what you want https://www.npmjs.com/package/@cucumber/pretty-formatter

npm
Michael Stelly
2021-06-01 06:43:00

*Thread Reply:* Thanks for answering. It's not a formatting issue. I'd like to see output like this

Michael Stelly
2021-06-01 06:44:07

*Thread Reply:* Apparently, that's not a cucumber question. Probably a reporting feature in mocha.

Michael Stelly
2021-06-01 06:44:41

*Thread Reply:* But I wasn't aware of the Prettier for Cucumber. So that's a good reference for later.

Michael Stelly
2021-06-01 07:19:19

*Thread Reply:* To be more clear, I get output for passed steps IF I have a failing step. But if all pass, I simply get pass notification.

Michael Stelly
2021-06-01 08:21:39

*Thread Reply:* Ahh. Now I see. The lesson on configuring cucumber with this formatter doesn't appear until later. I just arrived at it.

Michael Stelly
2021-06-01 08:24:45

*Thread Reply:* Cool. This is exactly what I was looking for: ``` Rule: Shouts can be heard by other users

Scenario: Listener hears a message # features/hear_shout.feature:7
  Given a person named Sean
  And a person named Lucy
  When Sean shouts "free bagels at Sean's"
  Then Lucy should hear Sean's message```
Michael Stelly
2021-06-01 08:25:29

*Thread Reply:* Thanks, @David Goss

👍 David Goss
Jonathan Coombs
2021-06-02 10:20:40

Ping on release of fix for https://github.com/cucumber/cucumber-js/issues/1534 , looks like it has been addressed and merged into master but has not been included in a release yet.

Assignees
davidjgoss
Labels
🐛 bug, since-7
Aslak Hellesøy
2021-06-02 10:50:34

@Jonathan Coombs we don't deliberately delay releases. Please be patient.

Jonathan Coombs
2021-06-02 10:51:50

*Thread Reply:* What are the considerations for a release? Otherwise my question was asked due to ignorance.

Aslak Hellesøy
2021-06-02 10:54:26

*Thread Reply:* Typically when there is a consensus amongst the core team that we're ready for a release. We meet online on Thursdays to discuss. Then, if we feel a release is ripe, somebody has to spend time doing a bit of manual testing, write up release notes and make a release.

Jonathan Coombs
2021-06-02 10:55:01

*Thread Reply:* Okay, thank you for that information.

Orbit
2021-06-02 18:07:41

@Orbit has joined the channel

Michael Stelly
2021-06-07 08:43:48

How do I represent the alternate path for required "givens"? I have 3 required form fields. Using Given, and, and... shows requirement. How do I write the scenario that says the submit button is not enabled until all three are selected?

Michael Stelly
2021-06-07 08:45:25

Please tag me if you have a solution.

Michael Stelly
2021-06-07 11:04:10

Here is the scenario that needs help. I think I need conditional actions, but I'm not quite clear how to make this play correctly Scenario: Enable the Add to Favorites button When the consumer is viewing an item And the consumer selects an item And the consumer selects a size And the consumer selects a quantity Then the Add to Favorites button is enabled Maybe in a Before() because the state and the actions all need to be true for all the subsequent scenarios. 🤔

Michael Stelly
2021-06-07 11:57:18

Oh. I found the Background keyword. That may be what I was looking for. Nah. That's not quite it. I don't want all the selections to be true for each scenario. (continues trek up Mt. LearningCurve).

Michael Stelly
2021-06-07 13:41:39

I refined it a bit. Still working on the negative use case. ```Background: Given the consumer selects an item

Scenario: Enable Add to Favorites button When the consumer selects the size and quantity options Then the Add to Favorites button is enabled```

matt-SmartBear
2021-06-07 15:32:35

@Michael Stelly a couple of little heuristics that help me write (and think about) gherkin steps:

  1. write your Given / context steps in past tense
  2. use present tense for When / action steps (you're already doing that)
  3. use should in your Then / outcome steps.
matt-SmartBear
2021-06-07 15:34:32

Using those I'd tweak your latest iteration to this:

```Background: Given the consumer has selected an item

Scenario: Enable Add to Favorites button When the consumer selects the size and quantity options Then the Add to Favorites button should be enabled``` Honestly, this kind of low-level UI logic is something I'd probably not use Gherkin for. I'd rather use a unit test for the UI component, but that's not the question you're asking 🙂

👍 Michael Stelly
Michael Stelly
2021-06-08 05:32:35

That makes sense. I remember from my last foray into BDD that my thinking was not abstract enough. That's a good call out. Thanks.

Michael Stelly
2021-06-08 05:38:48

So, the behavior would be what? That's what I'm trying to work out in my head. BTW, I'm playing as all 3 amigos because I'm creating a demo for the scrum team.

Michael Stelly
2021-06-08 07:13:20

My struggle right now is understanding what is the behavior (declarative) that drives implementation (imperative). As a consumer who is shopping on the App, I'd like the ability to favorite items that I maybe interested in. Would this be more declarative? @matt-SmartBear

Michael Stelly
2021-06-08 07:37:42

*Thread Reply:* So my current iteration looks like this ```Background: Consumer is shopping Given the consumer is shopping on the app

Scenario: Favorite an item When the consumer finds a desired item Then the app should allow the consumer to add it to the favorites list``` No buttons, no checkboxes for size/quantity. Just adding something to a list.

matt-SmartBear
2021-06-08 08:14:43

*Thread Reply:* I like that better

matt-SmartBear
2021-06-08 08:16:07

*Thread Reply:* The Given step is not using past tense though, which might be a signal something's wrong.

matt-SmartBear
2021-06-08 08:16:38

*Thread Reply:* Remember you can specify Rule: now in Gherkin too. Cleaving between rules and examples is a really important part of this process.

Michael Stelly
2021-06-08 08:18:41

*Thread Reply:* The entire feature looks like this: ```Feature: Add item to Favorites

As a consumer (guest or member) who is shopping on the App, I'd like the ability to favorite items that I maybe interested in.

Rule: Any consumer, guest or member, can favorite an item after selecting a size, quantity, and shipping method

Background: Consumer is shopping Given the consumer is shopping on the app

Scenario: Favorite an item When the consumer finds a desired item Then the app should allow the consumer to add it to the favorites list``` Let me think on the "given is past tense" comment

matt-SmartBear
2021-06-08 08:19:06

*Thread Reply:* Sweet

matt-SmartBear
2021-06-08 08:19:28

*Thread Reply:* I wonder if you need more stuff like a given to set up the state that there is a "desired item" in your database somewhere for them to find.

matt-SmartBear
2021-06-08 08:19:45

*Thread Reply:* I don't think that's implicit in "the consumer is shopping on the app"

Michael Stelly
2021-06-08 08:21:29

*Thread Reply:* As I mentioned, this is a PoC to introduce BDD to a naive audience - the product team.

matt-SmartBear
2021-06-08 08:23:05

*Thread Reply:* I like your scenario title. Follows the "Friends episode" heuristic nicely.

Michael Stelly
2021-06-08 08:23:16

*Thread Reply:* I want to keep it light on details so that I don't overwhelm them. In terms of our crawl/walk/run stage, we're not even on our hands n' knees, yet.

matt-SmartBear
2021-06-08 08:23:17

*Thread Reply:* "The one where the consumer favourites an item"

Michael Stelly
2021-06-08 08:27:00

*Thread Reply:* Would a better "given" be Consumer opened the app? That seems trite and empty. I'm a bit confused on where to draw the line between the declarative behavior and the imperative implementation.

matt-SmartBear
2021-06-08 08:43:26

*Thread Reply:* Have you added any automation under the hood yet?

Michael Stelly
2021-06-08 08:53:50

*Thread Reply:* No, this is the very start of our foray into BDD. I'm still trying to get a grasp of the concepts. Here's my revised background. Background: Consumer searched the product inventory Given the consumer searched the product inventory I'm viewing the Cucumber School videos and trying to apply the concepts to this selected feature as a real-world example.

matt-SmartBear
2021-06-08 09:13:34

*Thread Reply:* The magic of Gherkin is that it sits on the problem/solution domain boundary. You're working hard here to make it work in the problem domain, but I think you've started to spin the wheels a bit as you haven't had any feedback from the solution domain yet.

I'd suggest at least thinking about how you'd automate each of these steps, and then consider whether you've missed any additional steps that would be necessary to actually automate the whole scenario (assuming empty state in the system at the beginning), and then how you would express those in a way that makes sense in the problem domain.

Michael Stelly
2021-06-08 09:24:31

*Thread Reply:* I have a rudimentary start to that, like the beginnings of a Consumer and Network class. This is very much the "fix (enhance) the car while driving it" situation. The app in question is a live production mobile app. All the infrastructure and supporting data are already in place. Add to Favorites is a completely new feature which is why I selected it for the demo. As the only proponent of BDD in the organization, I have to rely completely on outside help like this forum, videos, tutorials and whatever else I can glean from the internet, to guide me. Your help is invaluable.

Michael Stelly
2021-06-08 11:01:16

*Thread Reply:* Of course, now this begs the question: what are the feature boundaries? How difficult is it to start using BDD for an already mature, production app?

Michael Stelly
2021-06-11 08:52:51

*Thread Reply:* I found the SmartBear youtube channel. This webinar outlined all the points you were helping me understand. Hope it can help others. https://youtu.be/awwFfCYoGFQ

YouTube
SmartBear (https://www.youtube.com/c/Smartbear)
matt-SmartBear
2021-06-11 13:14:16

*Thread Reply:* Ha nice one! @Jo Laing I guess we need to do a better job of signposting people to these videos. (Or we could re-publish them on school?)

matt-SmartBear
2021-06-11 13:15:24

*Thread Reply:* While we're talking youtube there's also a Cucumber channel with a lot of interesting talks from our conference:

https://www.youtube.com/channel/UC0eV4MhnmCd-48XdDhzf6Hg

YouTube
luke
2021-06-08 07:29:07

thats your connextra at the top. That has "less" of a stylistic feel as that's something that often will come / be driven by your business people (BA/PO)

luke
2021-06-08 07:29:40

so as an example (Whilst we didn't have this at a previous job), we could have had connextras that featured phrases such as

luke
2021-06-08 07:30:03

Scenario 1 search and Scenario 4 refinement and Deep-linked dog searches

Péter Zsilák
2021-06-09 03:49:12

@Péter Zsilák has joined the channel

Péter Zsilák
2021-06-09 05:38:46

Hi, Is there anyone who has experience with the WebdriverIO custom reporter? Or with CucumberJS reporter? I would like to integrate the Cucumber test results into the Testrail, but I am stucked a little. I installed babel when I initialised the wdio project and I followed this instruction: https://webdriver.io/docs/customreporter but I am confused now: ```import WDIOReporter from '@wdio/reporter' ^^^^^^

SyntaxError: Cannot use import statement outside a module```

webdriver.io
Mona Ghassemi
2021-06-09 06:28:04

*Thread Reply:* I don't think this is an issue with either of the reporters.

Before you use imports you need to make sure that, at the starting point of your code execution, you have Babel. Since wdio launches from the conf file, that is where you want to put it. So you will need a require here, but no-where else.

In wdio.conf.js include the following: // this allows wdio.conf.main.js to use es6 imports require("@babel/register")({ presets: ["@babel/env"], }); module.exports = require("./wdio.conf.main"); Put what you would normally have in wdio,conf.js in wdio.conf.main.js (or whatever name you find appropriate, just match it to the require in the file above.

You should be able to use es6 imports everywhere in your code after that.

👍 matt-SmartBear
Péter Zsilák
2021-06-09 06:37:27

*Thread Reply:* I uploaded my project here: https://github.com/peterzsilak/wdio-cucumber-testrail/tree/add_cucumber_reporter I can use imports in other files… Can you please check my code?

Mona Ghassemi
2021-06-09 06:59:55

*Thread Reply:* Well, I just cloned it (I'm actually curious about the Testrail integration, it's something I have thought about but never looked into). But I should be working right now. Can you first try implementing my suggestion? It is a tip I got straight from the WebdriverIO community after much wrangling with this issue, I am confident it will resolve your issue.

Péter Zsilák
2021-06-09 07:06:36

*Thread Reply:* Sure, I did, but and now I have a new error: Error: Type check for option "reporters" failed: a reporter should be either a string in the format "wdio-&lt;reportername&gt;-reporter" or a function/class.

Mona Ghassemi
2021-06-09 07:07:40

*Thread Reply:* Hmm I'm not familiar with this one.

Péter Zsilák
2021-06-09 07:08:04

*Thread Reply:* I committed the changes, if you want to check it. 🙂

Mona Ghassemi
2021-06-09 07:09:32

*Thread Reply:* Do you have something like // Test reporter for stdout. // The only one supported by default is 'dot' // see also: <https://webdriver.io/docs/dot-reporter> reporters: ["spec"], in your main wdio conf file? Perhaps your reporter needs to go there.

Péter Zsilák
2021-06-09 07:09:47

*Thread Reply:* yes

Mona Ghassemi
2021-06-09 07:09:55

*Thread Reply:* I suggest the WebdriverIO gitter community if you're still stuck

Péter Zsilák
2021-06-09 07:09:58

*Thread Reply:* reporters: ['spec', ['CucumberTestrailReporter', {}] ],

Mona Ghassemi
2021-06-09 07:10:03

*Thread Reply:* Ok

Mona Ghassemi
2021-06-09 07:10:23

*Thread Reply:* What are the { } ?

Mona Ghassemi
2021-06-09 07:10:28

*Thread Reply:* Can you try without?

Péter Zsilák
2021-06-09 07:10:56

*Thread Reply:* all same

Mona Ghassemi
2021-06-09 07:11:07

*Thread Reply:* What is the stacktrace for your error?

Mona Ghassemi
2021-06-09 07:11:31

*Thread Reply:* (Is there additional info with the line number)

Péter Zsilák
2021-06-09 07:11:37

*Thread Reply:* [0-0] 2021-06-09T14:10:40.165Z INFO @wdio/local-runner: Run worker command: run [0-0] 2021-06-09T14:10:40.361Z DEBUG @wdio/config:utils: Found 'ts-node' package, auto-compiling TypeScript files [0-0] 2021-06-09T14:10:40.682Z DEBUG @wdio/local-runner:utils: init remote session [0-0] 2021-06-09T14:10:40.684Z ERROR @wdio/runner: Error: Type check for option "reporters" failed: a reporter should be either a string in the format "wdio-&lt;reportername&gt;-reporter" or a function/class. Please see the docs for more information on custom reporters (<https://webdriver.io/docs/customreporter>) [0-0] at Object.validateConfig (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/config/build/utils.js:68:27) [0-0] at Object.remote (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/webdriverio/build/index.js:48:29) [0-0] at Object.initialiseInstance (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/utils.js:64:30) [0-0] at Runner._startSession (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/index.js:216:70) [0-0] at Runner.run (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/index.js:66:34) [0-0] at process.&lt;anonymous&gt; (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/local-runner/build/run.js:24:30) [0-0] at process.emit (events.js:327:22) [0-0] at process.EventEmitter.emit (domain.js:467:12) [0-0] at emit (internal/child_process.js:903:12) [0-0] at processTicksAndRejections (internal/process/task_queues.js:81:21) [0-0] 2021-06-09T14:10:40.685Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package [0-0] 2021-06-09T14:10:40.744Z ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't find plugin "CucumberTestrailReporter" reporter, neither as wdio scoped package "@wdio/cucumbertestrailreporter-reporter" nor as community package "wdio-cucumbertestrailreporter-reporter". Please make sure you have it installed! [0-0] at Object.initialisePlugin (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/utils/build/initialisePlugin.js:41:11) [0-0] at BaseReporter.initReporter (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/reporter.js:152:37) [0-0] at Array.map (&lt;anonymous&gt;) [0-0] at new BaseReporter (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/reporter.js:22:50) [0-0] at Runner.run (/Users/pzsilak/Projects/ReachAndAttract/wdio_cucumber/node_modules/@wdio/runner/build/index.js:77:26) [0-0] at processTicksAndRejections (internal/process/task_queues.js:93:5) 2021-06-09T14:10:40.771Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1

Mona Ghassemi
2021-06-09 07:11:43

*Thread Reply:* Oh boy 😄

Péter Zsilák
2021-06-09 07:11:51

*Thread Reply:* 😄

Mona Ghassemi
2021-06-09 07:12:55

*Thread Reply:* Well I see also this

Mona Ghassemi
2021-06-09 07:12:56

*Thread Reply:* " Error: Couldn't find plugin "CucumberTestrailReporter" reporter, neither as wdio scoped package "@wdio/cucumbertestrailreporter-reporter" nor as community package "wdio-cucumbertestrailreporter-reporter". Please make sure you have it installed!"

Mona Ghassemi
2021-06-09 07:13:05

*Thread Reply:* So something isn't configured correctly

Mona Ghassemi
2021-06-09 07:13:16

*Thread Reply:* I see it also directs you here https://webdriver.io/docs/customreporter/

webdriver.io
Péter Zsilák
2021-06-09 07:13:30

*Thread Reply:* 😄

Péter Zsilák
2021-06-09 07:13:41

*Thread Reply:* I followed this guide

Mona Ghassemi
2021-06-09 07:13:43

*Thread Reply:* So if that isn't enough to figure it out, again I would suggest the WebdriverIO Gitter community

Mona Ghassemi
2021-06-09 07:13:54

*Thread Reply:* the original issue you asked about is resolved

Mona Ghassemi
2021-06-09 07:14:03

*Thread Reply:* And we are way out of cucumber land 😄

Péter Zsilák
2021-06-09 07:15:08

*Thread Reply:* Look, I don’t understand this resolution…. when I installed the wdio I installed Babel also… And everything was okay, just this reporter did not wanted to work…

Mona Ghassemi
2021-06-09 07:15:10

*Thread Reply:* I don't think I would be able to help further without really digging into it; it's not something I have worked on 🙂

Péter Zsilák
2021-06-09 07:15:40

*Thread Reply:* Okay, and thanks for your help,… I will look around in WebdriverIO Gitter. 😉

👍 Mona Ghassemi
Péter Zsilák
2021-06-09 07:15:49

*Thread Reply:* Have a nice day.

Mona Ghassemi
2021-06-09 07:16:05

*Thread Reply:* Thanks, you too!

Michael Stelly
2021-06-11 10:11:15

I have a nearly identical pair of scenarios. The only difference is whether the actor is logged in or not. So has/has not logged in, and status changes from guest to member. Insert phrase accordingly. Rather than write two separate scenarios, how can I simplify this? Scenario: Favorite an item - member Given I have logged in And I have searched the product inventory When I find a desired item And I choose a size And I choose a quantity And I choose a shipping method Then the app should allow me to add it to my member favorites list Can I tidy up the When section? Would I use an example table for log in and status?

Mona Ghassemi
2021-06-11 10:18:46

*Thread Reply:* • You could simplify the When section (yes). For example, you could obfuscate the size / quantity / shipping method details and move that logic to your helper steps, especially if the details are "incidental" to the test.
• You could use an example table.

Michael Stelly
2021-06-11 11:13:02

*Thread Reply:* Ok. They're not incidental. They are pre-reqs. Before an item can be "favorited", all 3 -size/qty/ship values - must be chosen.

Michael Stelly
2021-06-11 11:14:46

*Thread Reply:* Maybe I can say something like "when pre-reqs are selected" bc, who knows, maybe they could change at some point.

Michael Stelly
2021-06-11 11:15:48

*Thread Reply:* Like this: When I find a desired item And pre-requisites are selected

Mona Ghassemi
2021-06-11 11:16:49

*Thread Reply:* Sure, or even tweak the language slightly so it's just one step. "When I select a desired item with specified characteristics"

👍 Michael Stelly
Mona Ghassemi
2021-06-11 11:19:28

*Thread Reply:* You don't want that to get complicated though. The point being, what we're really testing is "adding the item to favourites" and we don't really care what the specific items are that we need to do before that, which, as you stated, could change (when that happens, you can change the implementation code, but would no longer need to change the scenario)

Michael Stelly
2021-06-11 11:20:47

*Thread Reply:* Right. The scenario should indicate that there are conditions that must be in place before I can succeed.

Michael Stelly
2021-06-11 11:21:20

*Thread Reply:* and that should be enough. What the conditions are, is not relevant here.

Michael Stelly
2021-06-11 11:22:41

*Thread Reply:* This works for me. Thanks! 🙏

matt-SmartBear
2021-06-11 13:17:28

*Thread Reply:* The interesting thing about distilling steps like this is you have to find a name for the distilled concept. You've used "pre-requisites" here, for example. That then becomes part of your domain language.

matt-SmartBear
2021-06-11 13:17:46

*Thread Reply:* It's useful to check in with your domain-experts to make sure they like the terminology and buy into it.

👍 Mona Ghassemi
matt-SmartBear
2021-06-11 13:18:05

*Thread Reply:* @Mona Ghassemi you know your stuff!

Mona Ghassemi
2021-06-11 13:25:19

*Thread Reply:* 😊

luke
2021-06-14 03:07:25

*Thread Reply:* Why don't you just an outline?

👍 Mona Ghassemi
Mona Ghassemi
2021-06-14 07:45:23

*Thread Reply:* I think the Example table goes along with the Scenario Outline, doesn't it? 🙂

luke
2021-06-14 08:15:20

*Thread Reply:* yes sorry, they are a pair. I missed your comment earlier.

👍 Mona Ghassemi
Veronika Tio
2021-06-13 19:37:45

@Veronika Tio has joined the channel

Akshu
2021-06-17 05:16:58

@Akshu has joined the channel

Akshu
2021-06-17 05:51:35

Hi, I have a json report that I'd like to feed in for a HTML report. I have given npm install multiple-cucumber-html-reporter I have a json file under my repository. Could anyone please share the steps and commands I need to execute?

Any help would be appreciated! Thanks!!!

matt-SmartBear
2021-06-17 09:39:30

*Thread Reply:* I hadn't seen that multiple-cucumber-html-reporter package before. It's not something we maintain so unless another user or the maintainer are hanging out here you're going to be on your own 😞

There seems to be quite good docs at https://github.com/wswebcreation/multiple-cucumber-html-reporter#readme

What have you tried already?

Stars
143
Language
JavaScript
Akshu
2021-06-18 00:20:01

*Thread Reply:* I'd like to export my cucumber tests in a report format (preferably HTML). That's my scenario. I don't have much inputs or commands for it yet and I'd like some inputs

Patrick Poon
2021-06-17 11:26:39

@Patrick Poon has joined the channel

Aslak Hellesøy
2021-06-17 14:04:53

Hi everyone - @cucumber/cucumber 7.3.0 is out! https://twitter.com/cucumberbdd/status/1405632173563170825

twitter
Cucumber (https://twitter.com/cucumberbdd/status/1405632173563170825)
👏:skin_tone_3: Jim Trenowden
👏 Akshu, Michael Stelly
Akshu
2021-06-18 00:27:54

*Thread Reply:* If i give npm install @cucumber/cucumber How will I execute my feature file? Is it ./node_modules/.bin/@cucumber/cucumber or how do I execute it?

Aslak Hellesøy
2021-06-18 00:31:22

Hi @Akshu - run ./node_modules/.bin/cucumber-js

Aslak Hellesøy
2021-06-18 00:33:46

*Thread Reply:* (Normally there shouldn't be any files called ./node_modules/.bin/@cucumber/cucumber)

You can also add this to your package.json:

{ "scripts": { "test": "cucumber-js" } } And run npm test (npm autimatically adds ./node_modules/.bin to your PATH)

:thumbsup_all: Akshu
Akshu
2021-06-18 00:34:36

*Thread Reply:* Oh!!! I wasn't aware of it until now! Thanks!

Michael Stelly
2021-06-20 07:44:23

*Thread Reply:* I use something similar "scripts": { "test": "cucumber-js -f @cucumber/pretty-formatter" } Then run yarn test from cli

Theres Staudigl
2021-06-18 00:32:05

@Theres Staudigl has joined the channel

Akshu
2021-06-18 00:33:12

Thanks @Aslak Hellesøy!!!!

👍 Aslak Hellesøy
Akshu
2021-06-18 00:36:29

Also, I've a test.feature and test-report.json file. What input should I give in html-formatterto generate a html report?

I went through the github repo but it has tons of info that I could understand..How should my command be?

Aslak Hellesøy
2021-06-18 00:40:16

*Thread Reply:* Use cucumber-js --format html:cucumber.html

Also see cucumber-js --help for full help about the command line options.

:thumbsup_all: Akshu
Aslak Hellesøy
2021-06-18 00:40:45

*Thread Reply:* (This should create a cucumber.html report in your current directory)

Akshu
2021-06-18 00:42:25

*Thread Reply:* Thanks!

matt-SmartBear
2021-06-18 06:57:21

*Thread Reply:* There's also --publish which will create a HTML report automatically at https://reports.cucumber.io

reports.cucumber.io
:thumbsup_all: Akshu
Alexandre Lévêque
2021-06-18 10:11:17

@Alexandre Lévêque has joined the channel

👋 Alexandre Lévêque
Vinayak Walhe
2021-06-22 01:06:08

@Vinayak Walhe has joined the channel

James Cordell
2021-06-24 03:17:33

@James Cordell has joined the channel

Mohamed Soliman
2021-06-25 04:04:47

@Mohamed Soliman has joined the channel

Mohamed Soliman
2021-06-25 04:55:48

Hello all, I posted this is #help but I think it better suits here. I am new to Cucumber-js and I am trying to use --world-parameters in Cucumber-JS like that npx cucumber-js .\qa\features\login.feature --world-parameters '{\\\"config\\\":\\\"qa\\\"}' When using console.log(this.parameters.config); inside my step or Hook, I get 'undefined' .. Do you know if I should use it some other way.

Aslak Hellesøy
2021-06-25 06:12:03

*Thread Reply:* Hi @Mohamed Soliman are you also using `setWorldConstructor`` to use a custom class for your world?

Mohamed Soliman
2021-06-25 06:12:50

*Thread Reply:* nope.. I just need the basic world to pass variables from CLI to stepdefinitions

Aslak Hellesøy
2021-06-25 06:13:59

*Thread Reply:* Are you using arrow functions or regular functions for your hooks/steps?

Mohamed Soliman
2021-06-25 06:14:37

*Thread Reply:* arrow functions

Aslak Hellesøy
2021-06-25 06:14:45

*Thread Reply:* Try changing to a regular function

Aslak Hellesøy
2021-06-25 06:16:29

*Thread Reply:* In general, if you use arrow function, this will not have the value of your world object.

Aslak Hellesøy
2021-06-25 06:19:12

*Thread Reply:* There isn't anything we can do about this in Cucumber.js - it's a feature of the JavaScript language:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#call_apply_and_bind

> Arrow functions establish "this" based on the scope the Arrow function is defined within.

developer.mozilla.org
Mohamed Soliman
2021-06-25 06:20:27

*Thread Reply:* it worked upon changing to normal function..

👍 Aslak Hellesøy
Mohamed Soliman
2021-06-25 06:20:41

*Thread Reply:* Thank you very much,

Aslak Hellesøy
2021-06-25 06:20:50

*Thread Reply:* No problem

Mohamed Soliman
2021-06-25 06:21:18

*Thread Reply:* but it was not clear when reading through world.md document, I was trying for a whole day and it was not mentioned anywhere

Aslak Hellesøy
2021-06-25 06:22:12

*Thread Reply:* You should have asked sooner 🙂 - I'll add a note about this in the docs.

Mohamed Soliman
2021-06-25 06:22:23

*Thread Reply:* Thank you very much

Aslak Hellesøy
2021-06-25 06:24:11

*Thread Reply:* Just noticed it's the first question in the FAQ: https://github.com/cucumber/cucumber-js/blob/main/docs/faq.md#the-world-instance-isnt-available-in-my-hooks-or-step-definitions

Mohamed Soliman
2021-06-25 06:26:19

*Thread Reply:* oh yes.. I missed it while searching.. Thanks, sir

Aslak Hellesøy
2021-06-25 06:26:40

*Thread Reply:* But it's easy to miss, so I'll add some more mentions of it 🙂

Aslak Hellesøy
2021-06-25 06:46:06

*Thread Reply:* @Mohamed Soliman hopefully this makes it clearer!

Aslak Hellesøy
2021-06-25 06:46:07

*Thread Reply:* https://github.com/cucumber/cucumber-js/pull/1705

Labels
📖 documentation
Mohamed Soliman
2021-06-25 06:47:14

*Thread Reply:* much much better .. Thank you

Michael Morris
2021-06-25 11:21:04

*Thread Reply:* For what it's worth it stumped me as well at first. I mention this in the commands of my tester's documentation for the benefit of my other team members.

👍 Mohamed Soliman
Michael Morris
2021-06-25 10:41:53

I would like to launch cucumber like this npm test -- --show-browser During my Before step I would read the command line args and have Puppeteer display the GUI if that flag is present. I know how to do this, but I need help figuring out how to stop Cucumber from erroring out because it saw an unrecognized option flag.

Michael Morris
2021-06-25 10:43:47

*Thread Reply:* I've built a wrapping file to start my cucumber tests already. It can read the command line arg before the cucumber library even loads, but can I remove the arguments I've handled from the argv line? I've looked into cucumber deeply enough to know it's using commander as its cli reading dependency.

Michael Morris
2021-06-25 10:45:46

*Thread Reply:* Another tact would be to expand the capabilities of cucumber to allow the test writer to register additional command line flags.

Michael Morris
2021-06-25 10:48:09

*Thread Reply:* Also note - I'm well aware of profiles and they are very powerful. I use the world parameter to feed puppeteer its basic parameters already - mostly which device to emulate. BUT the showbrowser mode is something I would want to be able to turn on with any profile, so I can't really make it active in certain profiles. I also don't want to ask my users to edit the cucumber.js to turn the browser GUI on or off.

Michael Morris
2021-06-25 11:03:25

*Thread Reply:* Or maybe this is possible by working with Commander directly in the program flow...

Michael Morris
2021-06-25 11:25:24

*Thread Reply:* Ok, I have a solution. I can look for my custom flags before starting Cucumber, and if I see them slice them out of the argv array like so: if (process.argv.indexOf('--show-browser') &gt; -1) { process.env.headlessBrowser = false; process.argv.splice(process.argv.indexOf('--show-browser'), 1); } else { process.env.headlessBrowser = true; }

Michael Morris
2021-06-25 11:26:25

*Thread Reply:* Later in the same file I then hand off process control to Cucumber like so: require('@cucumber/cucumber/bin/cucumber-js');

Michael Morris
2021-06-25 11:26:53

*Thread Reply:* I really wish that hand off mechanism was documented somewhere.

Michael Morris
2021-06-25 11:27:18

*Thread Reply:* I discovered it reading over the code.

David Goss
2021-06-25 13:36:22

*Thread Reply:* We don’t really have a programmatic API for running cucumber at the moment, this is something we’re going to be working on shortly.

I believe you can repeat the —profile arg and the profile contents are merged. World parameters are also merged together. So could have a profile that just adds your showBrowser option as a world parameter, and this could be activated in conjunction with any other profiles. So you could use that pattern to effectively build up custom CLI options by way of composable profiles.

David Goss
2021-06-25 16:28:19

*Thread Reply:* Ran a quick test to make sure I wasn't imagining this.

In cucumber.js module.exports = { "foo": `--world-parameters '{"foo":true}'`, "bar": `--world-parameters '{"bar":true}'`, } And then npm test -- -p foo -p bar Yields

matt-SmartBear
2021-06-25 17:40:28

*Thread Reply:* or you could use an environment variable? That's what I usually do for this kind of thing.

👍 David Goss
binarymist
2021-06-25 23:34:30

Big thanks for working with us to get https://github.com/cucumber/cucumber-js/issues/1489 over the line @Aurélien Reeves !

Labels
🍼 incomplete
Comments
27
Aslak Hellesøy
2021-06-26 01:51:17

*Thread Reply:* Great work @Aurélien Reeves and @binarymist 🙌

👍 David Goss
Michael Morris
2021-06-29 06:42:46

Anyone have experience dealing with writing tests for core code and allowing extending code to also be tested? Of particular issue is with defining steps. I want to load the steps of my child project first, then look over the steps of the parent project and only define the undefined steps. Then I have to write the code in such a way that parent steps can be overrode.

Michael Morris
2021-06-29 06:44:39

*Thread Reply:* There wouldn't happen to be a "definitionExists( pattern )" function in the api would there? If there is great, if not I fear I'll need to write my own define step function that keeps track of what is and isn't defined.

Aslak Hellesøy
2021-07-02 08:20:09

https://twitter.com/cucumberbdd/status/1410980312939745287

twitter
Cucumber (https://twitter.com/cucumberbdd/status/1410980312939745287)
🎉 David Goss
matt-SmartBear
2021-07-05 11:11:45

*Thread Reply:* This is wonderful, thanks to everyone who put work into creating and publishing this!

I can't wait to give it a try.

I have two thoughts.

  1. One of the big benefits I've noticed from using screenplay is that interactions are composable, so you can start out with granular, imperative, building block interactions and use them to create higher-order interactions for domain-level actions that might involve multiple interactions with the system to achieve. Some versions of the Screenplay pattern call these "tasks". I don't see any mention of this from the readme. Is it currently possible with this framework?
  2. I've long thought that we could have some tighter integration between Cucumber and Screenplay, to be a bit opinionated about this being the "right way" to organise your automation code and make it super easy for people to use, for example by having the actor parameter type built in. I realise it's a bit early for that, but I wondered if you'd thought about that too, and about what it might look like?
matt-SmartBear
2021-07-05 11:12:04

*Thread Reply:* This might even inspire me to finish off that blog post series...

Mohamed Soliman
2021-07-06 09:45:22

Can someone refer to a good online course on CucumberJs which uses Page Object Model please?

Michael Morris
2021-07-12 20:48:15

Gonna share a little trick I figured out 🙂

Michael Morris
2021-07-12 20:48:38

*Thread Reply:* const { defineStep } = require("@cucumber/cucumber"); const readline = require("readline");

defineStep('pause', {timeout: _1}, async function() {   const rl = readline.createInterface({     input: process.stdin,     output: process.stdout   });      return new Promise((resolve) => {     rl.question("Pause Step in Gherkin. Press Enter to Continue.", () => {       rl.close();       resolve();     });   }); });

Michael Morris
2021-07-12 20:50:58

*Thread Reply:* So what this step does is pause cucumber. Useful for tests using Selenium or Chromium where you want to see what's going on in the browser, maybe click around a bit and check things.

matt-SmartBear
2021-07-12 21:56:18

*Thread Reply:* Nice!

Aurélien Reeves
2021-07-12 23:36:32

*Thread Reply:* Really nice trick! Thanks for sharing 😀

om prakash
2021-07-13 06:28:59

@om prakash has joined the channel

catharsisjelly
2021-07-13 06:32:05

@catharsisjelly has joined the channel

catharsisjelly
2021-07-13 06:32:05

Just re-posting this here in case anyone can help with a cucumber js specific issue.

catharsisjelly (https://cucumberbdd.slack.com/team/U023MEMAT5E)
Cat
2021-07-13 08:37:54

*Thread Reply:* Are you validating that the db is cleared when the before step runs?

:thankyou: Jo Laing
matt-SmartBear
2021-07-13 13:25:30

*Thread Reply:* @catharsisjelly maybe you're missing an await in your Before hook or something?

matt-SmartBear
2021-07-13 13:25:37

*Thread Reply:* that kind of thing trips me up all the time

catharsisjelly
2021-07-15 05:55:58

*Thread Reply:* @Cat No I assumed it was done, I'm used to PHP more so a few JS things are tripping me up

catharsisjelly
2021-07-15 05:57:22

*Thread Reply:* @matt-SmartBear My Before function hook looks like this if it helps Before(function () { for (let collection in dbConnection.collections) { dbConnection.collection(collection).drop() .catch((e) =&gt; {}); } });

catharsisjelly
2021-07-15 05:57:56

*Thread Reply:* I figured dropping the collections was the fastest way to truncate them

matt-SmartBear
2021-07-15 06:55:39

*Thread Reply:* Do you need to await the call to drop()? Does it return a promise?

catharsisjelly
2021-07-15 06:56:26

*Thread Reply:* it does, I have tried it with an await too and still errors.

matt-SmartBear
2021-07-15 06:57:33

*Thread Reply:* My guess is that's what's going wrong - it's a timing issue that means Cucumber has started the scenario before the drop() promise has resolved.

matt-SmartBear
2021-07-15 06:57:41

*Thread Reply:* Can you show us what it looks like when you use a promise?

catharsisjelly
2021-07-15 06:58:09

*Thread Reply:* Yeah I was thinking the same thing... You want to see the output or code?

matt-SmartBear
2021-07-15 06:59:08

*Thread Reply:* Both would be ideal!

catharsisjelly
2021-07-15 06:59:22

*Thread Reply:* I can do that 🙂

catharsisjelly
2021-07-15 07:05:44

*Thread Reply:* Oh.. maybe jest is trying to run 2 features concurrently...

catharsisjelly
2021-07-15 07:06:36

*Thread Reply:* I'll see if there is a way to "fix" that 🙂

catharsisjelly
2021-07-15 07:08:43

*Thread Reply:* If each feature runs fine all by itself that makes sense that itt might not if the second feature is running at the same time

matt-SmartBear
2021-07-15 07:08:57

*Thread Reply:* Yeah that will definitely cause yo problems if there is shared state

catharsisjelly
2021-07-15 07:09:17

*Thread Reply:* rubber duck

catharsisjelly
2021-07-15 07:32:21

*Thread Reply:* Not sure how to set that up using jest and cucumber-jest but I'll dig through some docs. But for now here is that Before function with the await Before(async function () { for (let collection in dbConnection.collections) { try { await dbConnection.collection(collection).drop(); } catch (err) { // collection does not exists, so iit does not matter that it was not dropped } } });

matt-SmartBear
2021-07-15 07:34:14

*Thread Reply:* That looks good to me. That should at least mean that two consecutive scenarios don't clash in the database. If you have concurrent scenarios running though, that's a different problem.

FWIW I think you could also use map to turn the collections array into an array of drop promises, and then return Promise.all of that, to make your code more concise.

👍 catharsisjelly
matt-SmartBear
2021-07-15 07:34:58

*Thread Reply:* It is possible to keep running scenarios concurrently, but you'll need to make sure everything going into the database has a unique ID,

matt-SmartBear
2021-07-15 07:35:53

*Thread Reply:* think about each scenario as a user working on your app - if you want them to be able to hit the app in parallel, you need to partition their data.

catharsisjelly
2021-07-15 07:37:20

*Thread Reply:* Yeah that helps thanks @matt-SmartBear It's slowly dawning what might be the issue. No idea how to fix iit yet but thats half the issue.

catharsisjelly
2021-07-15 07:53:51

*Thread Reply:* @matt-SmartBear for the map thing, do you have any docs links I could read up on how that works, it's not a JS concept I'm aware of

matt-SmartBear
2021-07-15 07:56:56

*Thread Reply:* Not sure of a good link for this. Here's how I think the code might look: Before( () =&gt; Promise.all( dbConnection.collections.map( collection =&gt; dbConnection.collection(collection).drop() ) ) )

👍 catharsisjelly
catharsisjelly
2021-07-15 07:57:51

*Thread Reply:* Thank you

matt-SmartBear
2021-07-15 07:59:03

*Thread Reply:* Essentially, if drop() returns a promise, you can use map to turn the array of collections in to an array of promises to drop those collections. Then you can use Promise.all to turn that into a single promise that all of the collections have been dropped. Then you can give that single promise to Cucumber as the thing you want it to do before it runs a scenario.

catharsisjelly
2021-07-15 07:59:50

*Thread Reply:* Yeah just reading the Mozilla docs on Promise.all

👍:skin_tone_3: matt-SmartBear
Johnson
2021-07-13 22:49:18

@Johnson has joined the channel

Joshy Josh
2021-07-15 15:15:36

@Joshy Josh has joined the channel

Michael Morris
2021-07-15 19:42:16

What do you call a cucumber in a cucumber?

Michael Morris
2021-07-15 19:46:00

*Thread Reply:* I have some code that wraps around cucumber - it starts go hugo server and cucumber in child processes and shuts down the hugo server when the cucumber thread finishes. It also has Puppeteer js getting started and stopped and an API mocking server built on express. It's solid, but a bit complex and it has a few command line flags. I am currently writing cucumber tests of those flag using root cucumber - and it's working so I have the situation of a cucumber running in a cucumber.

What is that called though? 🙂

Michael Morris
2021-07-16 06:51:38

*Thread Reply:* Joking aside, my inner cucumber process isn't emitting any output but the .'s. My console log statements are being lost.

Michael Morris
2021-07-16 10:59:25

Hmm.. I'm running into trouble writing tests of the command line. I have written a cucumber test that can take log-level, device, language and debug flags off the command line, and I'm trying to write a cucumber test that runs the customized cucumber runner on the command line. I'm very close to getting it working, but I'm having trouble getting information out of the inner process to the outer one for examination. I've tried process.send / on.message - doesn't work. The console.log messages of the inner cucumber process are being suppressed even though I have { stdio : 'inherit' } set on the process. Oddly, I am getting output from the grandchild go hugo process, but that doesn't help. I've tried writing output to a file, and that works when the child process is alone, but isn't working when the child is invoked directly.

How does cucumber test it's own cli options? I'm guessing my solution is somewhere in the exiting codebase.

matt-SmartBear
2021-07-16 11:43:38

*Thread Reply:* We do this: https://github.com/cucumber/cucumber-js/blob/main/features/support/world.ts#L53

matt-SmartBear
2021-07-16 11:43:49

*Thread Reply:* Does that help?

Michael Morris
2021-07-16 13:59:15

*Thread Reply:* It will take me awhile to parse through it and understand it, but yeah, looks like what I need.

Michael Morris
2021-07-19 20:03:26

*Thread Reply:* Took a couple days but this did work. The largest problem points to something that might be addressed in Cucumber core.

Michael Morris
2021-07-19 20:03:56

*Thread Reply:* The tester was thrown off by a parameter being '"@devices"'

Michael Morris
2021-07-19 20:04:41

*Thread Reply:* Perhaps the parsing of the tags arg should silently toss extra quotes?

om prakash
2021-07-17 08:56:08

the world constructor is acessible to steps and hooks. how to use pom and have the world acessible in pom classes as well?

David Goss
2021-07-18 02:30:59

*Thread Reply:* A simple way is to have your page object classes take your World as an argument in their constructor. Then you can new them up from steps/hooks (or, manage the creation of page objects with your World itself)

om prakash
2021-07-18 02:34:15

*Thread Reply:* hmm i have taken the same approach. thanks for help

👍 David Goss
Luděk Nový
2021-07-17 13:19:50

@Luděk Nový has joined the channel

om prakash
2021-07-18 02:40:52

a common question: are you folks testing in chrome or chromium.Mostly modern node js tool support chromium and not chrome.Need some inputs on how others are testing

plocket
2021-07-22 14:04:37

*Thread Reply:* I’ve been testing in chromium. Not sure if you’re asking generally or want to hear from the dev team. I’m just a user.

slackbot
2021-07-18 02:40:53

Guten tag! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Tim Yao
2021-07-18 04:07:08

Question about VSCode JS function go to definition(F12) feature. Inside step definition, that feature doesn’t work. Is that something we know? Or it should work? That feature works in other js file in the project. Only not work inside step definition.

matt-SmartBear
2021-07-19 11:00:09

That doesn't make any sense to me @Tim Yao

matt-SmartBear
2021-07-19 11:01:59

Do you know how it works? Maybe you need to configure it to scan the features folder? Where is the waitForElementVisible function defined? What folder is that in?

Tim Yao
2021-07-19 22:21:22

*Thread Reply:* @matt-SmartBear You are right, actually it works. Only not work with the nightwatch.js commands. I will check that. Thanks!

Michael Morris
2021-07-21 12:51:13

So, would anyone be interested in seeing the trickery I came up with to get Cucumber-js to fully support being run under esm so that the tests can be written using ES6 modules?

David Goss
2021-07-21 13:11:42

*Thread Reply:* sounds good - been working on https://github.com/cucumber/cucumber-js/pull/1649 so interested to compare

Labels
⚡ enhancement
Comments
12
Michael Morris
2021-07-21 13:16:31

*Thread Reply:* I'll look at that branch in detail tonight after work.

Michael Morris
2021-07-21 13:18:16

*Thread Reply:* At a glance though that functionality will let me simplify my code stack further.

Michael Morris
2021-07-21 13:18:59

*Thread Reply:* Cause for the most part I'm running cucumber in a child process using node -r esm path/to/cucumber/

Michael Morris
2021-07-21 12:51:54

I think I might be able to extract it out into a cucumber-esm module for general use.

plocket
2021-07-22 14:05:51

A while ago github used to show the progress of the steps - that …… as the tests were running. It no longer shows that, even when I’m on the action page when the tests start. Does someone know how I can get that back?

Aurélien Reeves
2021-07-22 23:41:45

*Thread Reply:* I've never noticed that feature

Which CI are you using? If using github action, which action are you using?

plocket
2021-07-23 05:42:13

*Thread Reply:* [It is and has been a github workflow.] The only external actions I’m using, or have ever used, before the tests are: uses: actions/checkout@v2 uses: actions/setup-node@v1

plocket
2021-07-23 05:45:18

*Thread Reply:* [We are making] a framework that uses cucumberjs for some of its functionality. The start of the script in package.json is ./node_modules/.bin/cucumber-js --require ./lib/index.js. @Aurélien Reeves

Aurélien Reeves
2021-07-26 00:05:43

*Thread Reply:* When do you say that it showed the progress of the steps, what do you mean exactly? Would you have a screenshot?

plocket
2021-08-03 03:51:42

*Thread Reply:* I don’t have a screenshot, sorry. Didn’t know I’d need it 😉 You can see it in your terminal when you run it locally, though. As I said, it’s the little progress dots that appear - one for each step.

plocket
2021-08-03 03:52:56

*Thread Reply:* This is an example of what it looks like locally:

plocket
2021-08-03 03:53:34

*Thread Reply:* ☝️ @Aurélien Reeves. Sorry for the late reply. Slack doesn’t color the dot red if my username isn’t used.

Aurélien Reeves
2021-08-03 04:55:42

*Thread Reply:* @plocket are you talking about the progress formatter which shows dots on the console when executing tests? The thing that looks like the following:

```$ node ./bin/cucumber-js --format=progress ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

264 scenarios (264 passed) 1356 steps (1356 passed) 0m45.247s (executing steps: 0m33.205s)``` And they have disappear from your github workflow logs? In some place like on the screenshot attached?

plocket
2021-08-03 17:46:55

*Thread Reply:* Exactly, @Aurélien Reeves! That’s exactly it. I no longer see the dots on the github workflow logs.

plocket
2021-08-03 17:47:27

*Thread Reply:* And thanks for the ping. It’s been a crazy day and I wouldn’t have noticed at all.

Aurélien Reeves
2021-08-03 23:56:06

*Thread Reply:* Those dots are written to the console with the progress formatter.

Check the formatter(s) you are using within your workflow. If you want the dots back, make sure to add the progress formatter.

You can do that with command line arguments, but also with profiles.

Documentation for the profiles: https://github.com/cucumber/cucumber-js/blob/main/docs/profiles.md

Note: the progress formatter is not the same one than the progress-bar formatter.

plocket
2021-12-16 05:55:47

*Thread Reply:* I haven’t had a chance to look into this, but I did find that when I inserted console logs in the middle of the steps, the progress dots would appear as soon as the first console log happened. It makes me think this is a setting in github. Something about log levels or something. Maybe process.stdout.write doesn’t appear during the test run, while console.log does for some reason.

Aurélien Reeves
2021-12-16 06:14:40

*Thread Reply:* Do you want to show the progress from the github action in real-time? Do you have any issue with the progress formatter when executing the tests on your own computer?

plocket
2021-12-16 06:15:40

*Thread Reply:* I do want to show the progress in real time. Local tests show progress just fine.

Aurélien Reeves
2021-12-16 06:26:29

*Thread Reply:* Ok, thanks for the explanation.

This seems related to github, not to cucumber, specially if you are not encountering issues locally.

I guess github action logs are streamed one line at a time, when a new-line character is encountered. The progress formatter does not put new-line characters, so github action logs are not streamed in realtime.

You see some progress when you add some console.log because it will put a new-line character

Aurélien Reeves
2021-12-16 06:28:00

*Thread Reply:* You may consider using your own custom formatter. You may override the buil-in progress formatter and add new-line characters in addition to the dots. That should trigger the stream from github in "real-time"

plocket
2021-12-16 08:23:39

*Thread Reply:* We’ll put that in the issue to try. Does your GitHub show the progress?

Aurélien Reeves
2021-12-16 08:27:04

*Thread Reply:* As seen on the screenshot from last time, yes, it does

plocket
2021-12-16 08:29:35

*Thread Reply:* Ah, ok. That looked to me like progress dots after everything was done, not while the workflow was running. 👍

Aurélien Reeves
2021-12-16 09:30:08

*Thread Reply:* Oh, you meant the progress!? I guess not. As I said, GitHub shows logs per line, when it detect a new line character

plocket
2021-12-16 09:32:39

*Thread Reply:* Ok. Yeah, the new line thing happens to you too. That seems like it’s related to cucumber as well as GitHub, then, since cucumber isn’t putting a new line at the beginning of logging progress.

plocket
2021-07-24 04:49:18

Does someone know where I can look for more information about the above? ☝️

Tim Yao
2021-07-25 05:27:00

Can cucumber --retry success rate be logged into the report? For example, I set --retry 2 , it will rerun 2 times after fail. If I have 1 time passed and 2 failed, I will get pass on the report. That’s fine. However, after I read this https://automationpanda.com/2021/06/14/are-automated-test-retries-good-or-bad/, I think to have a success rate on the report(like the picture) will be a nice to have. In current cucumber json report, I couldn’t see any data relevant to the retry.

Aurélien Reeves
2021-07-26 00:08:51

*Thread Reply:* I think there won't be any retry after one success. So you won't have more than one success.

For example if you have --retry 10, one test fails on the first attempt, if it succeed at first retry, it won't retry anymore.

Tim Yao
2021-07-26 00:10:20

*Thread Reply:* Thanks @Aurélien Reeves . Sorry for the confusion, what I mean should be first two tries failed, and third passed.

Tim Yao
2021-07-26 00:11:12

*Thread Reply:* If that 1/3 pass success rate can be reported, it will help us to find out flaky issues.

Aurélien Reeves
2021-07-26 00:12:17

*Thread Reply:* Or at least the number of failed attempt

That is interesting. I suggest you submit a feature request: https://github.com/cucumber/cucumber-js/issues/new?assignees=&labels=&template=feature_request.md&title= 🙂

Tim Yao
2021-07-26 00:12:56

*Thread Reply:* exactly, just not ignore the flaky things happening.

Tim Yao
2021-07-26 00:13:30

*Thread Reply:* If it’s not a feature yet, happy to submit the request. Thanks @Aurélien Reeves!

Aurélien Reeves
2021-07-26 00:55:59

*Thread Reply:* I am not sure actually, but I don't think it is a feature yet. And it may depends also on which formatter you may request that feature. Some formatters are commonly used by severals implementation of cucumber, but the retry mechanism is not, so there may be interesting incoming discussion 😛

That would be easier to follow on a github issue than in a thread on slack 🙂

Tim Yao
2021-07-26 00:58:35

*Thread Reply:* Agree, I will put it into issue and see how it goes

luke
2021-07-26 01:33:48

*Thread Reply:* FYI you're not using the default html formatter, you're using something like a jenkins one, so you'd need to go there for that.

Tim Yao
2021-07-26 01:37:34

*Thread Reply:* Hi @luke that image is just from the article I linked. I am using https://github.com/gkushang/cucumber-html-reporter and checked in https://reports.cucumber.io/. Didn’t see the retried details.

Tim Yao
2021-07-26 01:38:05

*Thread Reply:* Do you mean it’s supported in cucumber default HTML formatter?

Tim Yao
2021-07-26 01:46:09

*Thread Reply:* I just tried html formatter and I couldn’t find retry relevant information.

Tim Yao
2021-07-26 01:57:15

*Thread Reply:* https://github.com/cucumber/cucumber-js/issues/1739 For further discussion.

Aurélien Reeves
2021-07-27 02:54:36

*Thread Reply:* Thanks @Tim Yao 👍

As you noticed: this request is related to formatters.

On Cucumber we may address some of our own ones, but when using other formatters like the one from gkushang, you should also ask them too.

Tim Yao
2021-07-27 03:48:06

*Thread Reply:* Yes. gkushang one is based on the deprecated json formatter, so I think I may switch to core html-formatter in the future.

matt-SmartBear
2021-07-28 10:16:51

*Thread Reply:* If there are features in the gkushang one you like that we're not implementing yet, we'd love to hear about it!

Tim Yao
2021-07-28 20:24:55

*Thread Reply:* Thanks @matt-SmartBear will try and see what is the difference

LayMui
2021-07-27 05:01:47

Hi I am using playwright with cucumber. checking out this repo https://github.com/cucumber/playwright.js/tree/main/features. however can someone tell me how I can run the test?

Aurélien Reeves
2021-07-27 05:36:49

*Thread Reply:* Do you want to execute the test of the playwright.js repository?

Aurélien Reeves
2021-07-27 05:49:33

*Thread Reply:* If so, try npm test

To execute the tests you are setting-up using cucumber and playwright.js, execute cucumber as usual

Aslak Hellesøy
2021-07-27 07:48:42

*Thread Reply:* Hi @LayMui don't get fooled by the name - it has nothing to do with the Microsoft Playwright library. See https://github.com/cucumber/playwright.js/issues/31 - we might rename it back to @cucumber/screenplay.js

Comments
13
🤔 Michael Stelly
👍 LayMui
Michael Morris
2021-07-27 12:14:31

I've been given permission to spend at least some of my worktime working on open source projects my company is using, Cucumber being chief among them. Simplifying ESM stands out and I've been pointed to the existing project and would like to join that effort. The last major Open Source project I worked with was Drupal. Do y'all have a page that lists out the ES-lint settings to use as well as any other pull request policies? Basically a getting started for contributors page?

:dancing_pickle: Jo Laing
Luděk Nový
2021-07-27 23:40:49

*Thread Reply:* maybe https://github.com/cucumber/cucumber-js/blob/main/CONTRIBUTING.md is what you are looking for?

Aurélien Reeves
2021-07-28 00:11:12

*Thread Reply:* Great news @Michael Morris!

Sadly we do not have a great contributor/developer documentation yet 😞

There is an on-going effort to improve documentation for new contributors. At the moment it was focused on cucumber-ruby and on the "welcoming" documents like README and CONTRIBUTING.

We have an issue to exchange ideas on that topic: https://github.com/cucumber/common/issues/1521

What kind of documentation were you looking for? Would you have some links to existing ones in other OSS projects as reference?

You can submit your suggestions, ideas and request in the issue, that will be easier to keep track later 👍

Assignees
aurelien-reeves
Labels
✨ kaizen
matt-SmartBear
2021-07-28 10:20:01

*Thread Reply:* That's fantastic @Michael Morris!

One of our goals for the year is to increase the number of new contributors, so anything you find difficult, confusing, or even just a little bit annoying as you take your first steps, we'd love to hear about it.

I'm available for 1:1 mentoring if you'd like some pairing time. https://calendly.com/mattwynne

Calendly
matt-SmartBear
2021-07-28 10:20:58

*Thread Reply:* FWIW, the place to start contributing for any github repo should be https://github.com/cucumber/cucumber-js/contribute

That page will show the contributing guide, and any issues tagged with "good first issue".

Michael Morris
2021-07-28 10:47:27

*Thread Reply:* K. Thank you all.

slackbot
2021-07-27 12:14:32

God dag! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

David Ambler
2021-07-29 05:22:30

@David Ambler has joined the channel

David Ambler
2021-07-29 05:22:45

Hey! I am migrating to cucumber-js 7.3.1 and can see that setDefinitionFunctionWrapper is being deprecated in v8. At the moment I use this to handle scenario timeouts (I am running tests inside an AWS lambdas). Been looking at the new BeforeStep hook, but I'm not sure I can replicate the desired behaviour with that... Has anyone achieved something similar?

David Ambler
2021-07-29 05:43:48

Was thinking perhaps might be able to use setDefaultTimeout within a BeforeStep hook, but seems this timeout value is evaluated before execution and updates to it are not respected.

Aurélien Reeves
2021-08-04 00:52:52

*Thread Reply:* If other users are looking into this, we have discussed this issue here: https://github.com/cucumber/cucumber-js/issues/1741

Labels
❓ question
Comments
15
Mona Ghassemi
2021-07-30 15:03:47

Is there a way to share state between an entire suite of tests as they run (vs on a per-test basis)? Currently running into a limitation due to a script that I can only run before test runs.

Tim Yao
2021-07-30 16:29:09

*Thread Reply:* env vars? 😄

Mona Ghassemi
2021-07-30 16:29:57

*Thread Reply:* I need it to be set during the first test and remain afterwards

Tim Yao
2021-07-30 16:29:58

*Thread Reply:* I think if it’s read only, env var works ok for me.

Mona Ghassemi
2021-07-30 16:30:14

*Thread Reply:* Not read only, need to write it first

Tim Yao
2021-07-30 16:30:39

*Thread Reply:* I am using nightwatch.js with cucumber.js, I use nightwatch globals to manage state.

Mona Ghassemi
2021-07-30 16:32:49

*Thread Reply:* Looks like a selenium alternative, not something I'm looking for ATM.

My best thought so far is to disable this new setup stuff until we've integrated the work being done in the pre-test script so that it can be run on demand, so we no longer run into this limitation.

Which means the recent work needs to be left on hold.

😞

Tim Yao
2021-07-30 16:35:01

*Thread Reply:* Can you just add vars to this ?

Mona Ghassemi
2021-07-30 16:35:32

*Thread Reply:* Doesn't work: https://github.com/cucumber/cucumber-js/issues/1393

Labels
⚡ enhancement
Comments
10
Mona Ghassemi
2021-07-30 16:36:30

*Thread Reply:* It will only work with Before hook, hence "per-test", which won't work with our current setup.

Tim Yao
2021-07-30 16:36:58

*Thread Reply:* In my use case, I have a global vars like test id, project name , also have some initialisation data as states to share across all tests.

Tim Yao
2021-07-30 16:37:48

*Thread Reply:* I also set test id to env var, so I can share the id across CI jobs.

Tim Yao
2021-07-30 16:38:12

*Thread Reply:* like multiple cucumber process can share the same test id.

Mona Ghassemi
2021-07-30 16:38:15

*Thread Reply:* You set an env var from inside the test?

Tim Yao
2021-07-30 16:38:41

*Thread Reply:* no, if I use env var, it’s set outside cucumber, like in CI job.

Mona Ghassemi
2021-07-30 16:39:31

*Thread Reply:* Right, I'm looking for a way to • set a variable inside a beforeAll hook • have it carry over to next tests

Tim Yao
2021-07-30 16:39:38

*Thread Reply:* world is state within scope of a single scenario

👍 Mona Ghassemi
Tim Yao
2021-07-30 16:40:08

*Thread Reply:* you can’t use world . ~But you may can use this?~

Mona Ghassemi
2021-07-30 16:40:10

*Thread Reply:* yep, that's exactly my issue, it won't carry to the next scenario

Mona Ghassemi
2021-07-30 16:40:43

*Thread Reply:* this, inside a cucumber scenario, or even hooks usually refers to the world object, does it not?

Tim Yao
2021-07-30 16:42:26

*Thread Reply:* I haven’t use world yet, looks like this is point to world .

👍 Mona Ghassemi
Tim Yao
2021-07-30 16:50:41

*Thread Reply:* By using global state, will it be a issue when we run cucumber parallel?

Mona Ghassemi
2021-07-30 16:51:16

*Thread Reply:* dunno, I don't think I'm doing that at the moment

Mona Ghassemi
2021-07-30 16:51:20

*Thread Reply:* but you have a point there

Mona Ghassemi
2021-07-30 16:51:56

*Thread Reply:* I just have to find the JS alternative to boto3 / awssrp, something I should have done a long time ago 🤷

Tim Yao
2021-07-30 16:52:29

*Thread Reply:* ideally we need to do node js stateless way. as it’s not work for multiple node process.

Tim Yao
2021-07-30 16:53:41

*Thread Reply:* I see https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md cucumber-js --parallel 3 only shares env vars, not in memory vars, that can cause you lost the global state. My nightwatch global won’t work in parallel I guess. 🙃

Tim Yao
2021-07-30 16:56:06

*Thread Reply:* To solve that problem, need to put state management into a shared db.

Tim Yao
2021-07-30 16:56:48

*Thread Reply:* Need some Cucumber expert to help here I think.

Tim Yao
2021-07-30 17:00:44

*Thread Reply:* boto3 / awssrp is for storing state in AWS s3? that sounds a good solution for me.

David Goss
2021-07-31 00:32:44

*Thread Reply:* @Mona Ghassemi what do you think to the proposal in the issue you linked? ie to allow some state to be set in a BeforeAll which you can then read (not write) from scenarios - would that solve your need?

matt-SmartBear
2021-08-01 23:56:19

*Thread Reply:* @Mona Ghassemi you should be able to use process.env.SOME_ENV_VAR = "a-value" in your beforeAll hook, and then read that later on, no?

matt-SmartBear
2021-08-01 23:56:59

*Thread Reply:* Or touch a file or something?

matt-SmartBear
2021-08-01 23:58:27

*Thread Reply:* (as a workaround for now)

Aslak Hellesøy
2021-08-03 19:52:25

*Thread Reply:* I’m surprised nobody has suggested using global variables yet. That’s a JavaScript thing, not a Cucumber thing.

Tim Yao
2021-08-04 04:11:59

*Thread Reply:* @Aslak Hellesøy I think you are talking about using global object like global.myTestState . I tested it, works. I think it’s same as my Nightwatch.js globals data. However, I guess it may not work in parallel. As it’s in the memory, not able to be sync between parallel processes. Haven’t test it yet.

Hunter Boaz
2021-08-02 14:50:42

@Hunter Boaz has joined the channel

jradom
2021-08-04 23:03:59

Hello all. Can anybody help with the Allure report configuration in Jenkins. We can get a local report with no problem. We’ve followed the manual but can’t get it. Any help will be greatly appreciated. We use Cypress and Cucumber pre-processor

matt-SmartBear
2021-08-05 09:39:31

*Thread Reply:* Can you share more about what you've tried, and what specific errors or other problems you've encountered?

jradom
2021-08-05 09:51:24

*Thread Reply:*

jradom
2021-08-05 09:51:42

*Thread Reply:*

Luděk Nový
2021-08-11 00:47:50

Hello, how does the parallel execution work? Does a worker execute random scenario or is this per file like jest does it?

David Goss
2021-08-17 13:55:01

*Thread Reply:* Yep it’s per scenario - once we get to actually running tests, which feature file it’s in doesn’t mean much.

David Goss
2021-08-17 13:56:28

*Thread Reply:* If you’re interested, someone is working on a way to control the allocation of scenarios to workers.

David Goss
2021-08-17 13:56:34

*Thread Reply:* https://github.com/cucumber/cucumber-js/pull/1588

Labels
⚡ enhancement
Comments
10
Luděk Nový
2021-08-18 00:10:34

*Thread Reply:* Thanks @David Goss!

Moretti Cédric
2021-08-11 05:18:25

@Moretti Cédric has joined the channel

grasshopper
2021-08-16 06:40:05

@grasshopper has joined the channel

Mona Ghassemi
2021-08-17 06:15:13

Is there a way for me to have access to the cucumber report link in my CI (Github actions) to forward the output to Slack or otherwise? I'm finding it's getting a bit tedious to click through. Perhaps the old way of creating a json or xml report and piping that into Slack? Curious if anyone has a workable solution. Thanks!

matt-SmartBear
2021-08-17 10:30:08

*Thread Reply:* @Aslak Hellesøy @Vincent Pretre?

matt-SmartBear
2021-08-17 10:32:56

*Thread Reply:* I have a feeling it's not super straightforward as that message "View your Cucumber Report at:..." is sent back verbatim from the reports server, so there's no structured data with the URL in it. I night be wrong though, but I think I've asked the same question before.

matt-SmartBear
2021-08-17 10:33:04

*Thread Reply:* Maybe @Christophe Bliard knows.

Mona Ghassemi
2021-08-17 10:36:45

*Thread Reply:* Thanks! If all else fails I think the old fashioned xml should be usable. Was hoping it would be easy-peasy-lemon-squeezy 🍋

Aslak Hellesøy
2021-08-18 01:52:47

*Thread Reply:* We have an open issue about this for Cucumber-JVM: https://github.com/cucumber/cucumber-jvm/issues/2324

If you’re using a different Cucumber implementation, please raise a corresponding issue.

Labels
⚡ enhancement
Comments
10
Aslak Hellesøy
2021-08-18 01:58:26

*Thread Reply:* FYI: Cucumber issues a GET request first. The server responds with 204 and an upload URL in the Location response header, plus a plain text banner that cucumber prints after PUT ing the cucumber messages to the «pseudo redirect» URL.

You can find a bash implementation of the upload client here: https://github.com/cucumber/common/blob/main/scripts/publish-cucumber-report

Mona Ghassemi
2021-08-18 08:23:59

*Thread Reply:* Thanks @Aslak Hellesøy! Yes, am using the js implementation so I guess I'll need to raise the issue. Will probably look into these internals a bit too when I get a chance!

Jiewen Xiong
2021-08-20 09:36:47

@Jiewen Xiong has joined the channel

jradom
2021-08-21 19:02:58

Hello All. We are using Cypress. Typescript and Cucumber-preprocessor plug-in. Our code works but it looks like preprocessir makes our code run very slowly . Can anyone suggest sum Cucumber alternative for Cucumber with Cypress. Any help will be greatly appreciated.

David Goss
2021-08-23 00:25:13

*Thread Reply:* It might be worth raising an issue here https://github.com/TheBrainFamily/cypress-cucumber-preprocessor - AFAIK that plugin only uses very little cucumber stuff - just the Gherkin parser.

Stars
814
Language
JavaScript
jradom
2021-08-23 08:54:45

*Thread Reply:* @David Goss I understand but my question was about if there is an alternative to cypress-cucmber-preprocessor

David Goss
2021-08-23 09:49:40

*Thread Reply:* It doesn’t look like it to me.

jradom
2021-08-23 12:20:04

*Thread Reply:* Thanks

MarkSweetlove
2021-08-22 14:57:45

Is it possible to append information to the messages sent to formatters? I want to include some data like the browser type my test is using. When running in a single process the formatter has access to the browser to find out, but when running in parallel the formatters don’t seem to have any information from the processes running the tests.

David Goss
2021-08-23 00:28:31

*Thread Reply:* Yes the formatters run on the coordinator and all the scenarios are running on the worker. You could this.log the information from a step or hook, which will emit an attachment. Also you might be interested in https://github.com/cucumber/common/issues/1317 which is about being able to emit custom stuff in the meta message, although again this would happen in the coordinator

Labels
❓ question
Comments
14
MarkSweetlove
2021-08-23 01:32:59

*Thread Reply:* Thanks David

Mona Ghassemi
2021-08-25 08:35:36

Hi, I've been having difficulty attempting to run scenarios but "not" scenarios with a certain tag. Online I see ~@tag format and "not @tag" format. Neither seems to have worked for me, not sure what I'm getting wrong. For example my run scripts look like: "testNightly": "node -r dotenv/config ./node_modules/.bin/cucumber-js --tags='@nightly'", Say I wanted to add a "not @notReady" to this. How would I structure that?

Aslak Hellesøy
2021-08-25 10:53:47

*Thread Reply:* Have you tried @nightly and @not @notReady?

Mona Ghassemi
2021-08-25 10:54:30

*Thread Reply:* nope!, so the "not" needs an @?

Aslak Hellesøy
2021-08-25 10:55:01

*Thread Reply:* Typo! @nightly and not @notReady

Mona Ghassemi
2021-08-25 10:55:52

*Thread Reply:* Ah. Will try that, I think I was trying to do it like @nightly, not @notReady

Aslak Hellesøy
2021-08-25 10:57:37

*Thread Reply:* Tag expressions are infix boolean expressions. There are no commas or other punctuation. https://cucumber.io/docs/cucumber/api/#tag-expressions

Mona Ghassemi
2021-08-25 10:58:01

*Thread Reply:* Thanks!

Aslak Hellesøy
2021-08-25 11:00:09

*Thread Reply:* Specifying only @nightly would be sufficient, unless you have scenarios tagged with both @nightly and @notReady. Why would you tag a @notReady scenario with @nightly?

Mona Ghassemi
2021-08-25 11:00:42

*Thread Reply:* It's just a toy example, I don't have a @notReady tag.

Aslak Hellesøy
2021-08-25 11:02:02

*Thread Reply:* 🙂

Mona Ghassemi
2021-08-25 11:02:06

*Thread Reply:* I didn't think through the example very hard but I do have cases where I want to exclude something 😄

Tim Yao
2021-08-26 00:02:28

Hi there, question for https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#--no-strict By default, cucumber works in strict mode, meaning it will fail if there are pending steps. What is the benefit to fail pending steps? I guess it is set as default by some reason? Otherwise I feel pending means uncompleted tests should just be ignored instead of fail.

Aurélien Reeves
2021-08-26 00:22:42

*Thread Reply:* I don't have the history of that, just a personal though: that could avoid forgetting about pending things

As a developer, at some point, I could totally forget about pending things, specially if they are totally ignored. However if they are responsible for failing my CI for example, I cannot ignore those

Tim Yao
2021-08-26 00:31:12

*Thread Reply:* Thanks @Aurélien Reeves that makes sense. In my case, I want to leave some test cases skipped based on the environment. For example, one test case works in most of browsers but not IE11, I may return pending for IE now and fix it in the future. However, I wish it can still pass CI in IE with this pending step.

Aurélien Reeves
2021-08-26 00:32:04

*Thread Reply:* In your case, would "skipped" be more appropriate than "pending"?

:dancing_pickle: Tim Yao
Tim Yao
2021-08-26 00:34:05

*Thread Reply:* It is just because I don’t know I can return skipped … looking at the docs now

Tim Yao
2021-08-26 00:38:31

*Thread Reply:* Works like a charm! Thanks @Aurélien Reeves I will stick with skipped then.

Aurélien Reeves
2021-08-26 00:42:38

*Thread Reply:* 😄 Glad I could help 🙂

luke
2021-08-26 01:33:03

*Thread Reply:* also for pending steps you can also tag the feature not to run (Which is probably better behaviour), it's what we do.

Tim Yao
2021-08-26 02:03:56

*Thread Reply:* @luke I do has tags like @skip then use it in cli tags like not @skip . But I see someone do it like this: Before({tags: "@skip"} async () =&gt; { return 'skipped'; }); So I don’t need to add not @skip to cucumber tags argument, is that a good practice?

luke
2021-08-26 02:07:32

*Thread Reply:* So there's a difference here, so if you do it that way, it'll return a cucumber skipped exception.

Now in my eyes, that is ok. So something then causing that to fail I wouldn't support. But I'm 99% certain that they aren't prohibited, just not defaulted.

luke
2021-08-26 02:07:55

*Thread Reply:* Because doing it dynamically on the fly also allows you to configure it based on params. Like we have a whole class that determines whether to skip a scenario.

Tim Yao
2021-08-26 02:10:48

*Thread Reply:* I get it'll return a cucumber skipped exception is the difference.

Tim Yao
2021-08-26 02:11:22

*Thread Reply:* And second way is dynamic may give me some flexibilities.

Tim Yao
2021-08-26 02:13:09

*Thread Reply:* irrelevant question maybe, how do you disable tests failed because defect?

Tim Yao
2021-08-26 02:13:45

*Thread Reply:* I tried to tag it @defect then use not @defect in command to ignore it.

Aurélien Reeves
2021-08-26 02:38:51

*Thread Reply:* That looks like something very specific to your need, so using tags as you did looks good to me

luke
2021-08-26 02:43:00

*Thread Reply:* yes we have @failing @NP-xxxx

luke
2021-08-26 02:43:06

*Thread Reply:* and then we use jira to track it

Tim Yao
2021-08-26 03:23:44

*Thread Reply:* cool. @NP-xxxx is your JIRA ticket number? @luke

luke
2021-08-26 03:26:35

*Thread Reply:* yes

luke
2021-08-26 03:26:48

*Thread Reply:* that tag does nothing. But we know every tag that has failing SHOULD have a ticket number assigned as well.

luke
2021-08-26 03:26:57

*Thread Reply:* that way when we fix it, it's an easy ctrl+f and delete

Tim Yao
2021-08-26 03:27:12

*Thread Reply:* awesome!

Tim Yao
2021-08-26 03:27:54

*Thread Reply:* I use a comment for that purpose. but tag sounds a better way.

SantoshK
2021-08-28 09:08:27

Can somebody tell me how to publish test result from .json file into 'test' tab in Azure DevOps pipeline? Currently, junit test runner does not publish it to the 'test and the 'test' tab is not visible. My tests are written in typescript + Cucumber is + playwright.

Dillon Barker
2021-08-31 01:05:25

@Dillon Barker has joined the channel

LayMui
2021-09-02 00:18:08

@Tally Barak how can I change the tag to run only certain scenarios? for example I want to only run test scenarios with the @test tag? https://github.com/Tallyb/cucumber-playwright/tree/master/features

Aurélien Reeves
2021-09-02 00:26:07

*Thread Reply:* You can do that exactly as you would with cucumber. For example you can use command line arguments: https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#tags

Or you could also use specific profiles: https://github.com/cucumber/cucumber-js/blob/main/docs/profiles.md

LayMui
2021-09-02 00:34:44

*Thread Reply:* I am not sure how I can run using npm run test?

Aurélien Reeves
2021-09-02 00:51:58

*Thread Reply:* Using profiles

Or updating package.json to add your filter into the "test" script

Or you don't use npm run test, but npx cucumber-js with the --tag argument

👍 Mona Ghassemi
Mona Ghassemi
2021-09-02 07:13:12

*Thread Reply:* We use something like this:

node ./node_modules/.bin/cucumber-js --tags='@tagName'

Tally Barak
2021-09-03 21:07:33

*Thread Reply:* make it shorter with npx cucumber-js --tags-"@tagName"

😄 Mona Ghassemi
Mona Ghassemi
2021-09-07 05:08:56

*Thread Reply:* Thanks will try!

Mona Ghassemi
2021-09-07 05:11:57

*Thread Reply:* We use named scripts in the package.json btw, so like: scripts: { testWeb: node ./node_modules/.bin/cucumber-js --tags='@web', ... }

and then at command line:

yarn run testWeb

(or npm if that's what you use).

Tally Barak
2021-11-10 06:34:14

*Thread Reply:* then you can simply put: cucumber-js --tags='@web'

Mona Ghassemi
2021-11-10 07:10:55

*Thread Reply:* I think I realized that my issue was that we use dotenv, but to be perfectly honest, I think I can remove it as the way we need to import variables per environment probably makes it redundant so we have ""node -r dotenv/config ./node_modules/.bin/cucumber-js --""

I will probably look at removing dotenv

LayMui
2021-09-02 00:45:13

@Tally Barak I tried to add new feature to your existing template on playwright-cucumber. it didn’t work. it give some undefined implementation steps. could you help shed some light? here is my repo https://github.com/LayMui/playwright-cucumber/tree/form-registration

Tally Barak
2021-09-02 01:11:30

*Thread Reply:* can you share the error?

LayMui
2021-09-02 01:57:18

*Thread Reply:* TSError: ⨯ Unable to compile TypeScript: src/steps/playwright.steps.ts:2:23 - error TS6133: ‘DataTable’ is declared but its value is never read.

2 import { Given, When, DataTable } from ‘@cucumber/cucumber’;

LayMui
2021-09-02 01:57:44

*Thread Reply:* my feature has datatable like this Scenario: Fill up registration form When he fill up his registration details | username | age | residency | accounts | nationality | | johnmark | 48 | resident | Savings | USA | Then he is able to submit his form

LayMui
2021-09-02 01:58:26

*Thread Reply:* but it seem to affect the original step defn by you @foo Scenario: Change theme # features/playwright.feature:7 Given Go to the playwright website ? undefined When Change theme to "light" mode ? undefined Then Snapshot - skipped When Change theme to "dark" mode ? undefined Then Snapshot - skipped

Tally Barak
2021-09-03 20:48:49

*Thread Reply:* I think Datatable was changed in Cucumber7, no?

LayMui
2021-09-02 07:24:52

Hi, I am not sure if this is cucumber.js, I got this error ☕ImplementationPendingError: Step implementation missing: [test_form:execute] [0-1] [test-form:execute] [0-1] Given('{actor} is at the embassy', function (actor) { but I have defined this step in the step definitions Given('{actor} is at the embassy', async (actor: Actor) =&gt; actor.attemptsTo( <a href="http://Navigate.to">Navigate.to</a>('/') ) ); not sure why it still complain missing step definition. here is the repo at config branch <https://github.com/LayMui/serenityJS-cucumber-wedriverio/blob/config/features/step-definitions/form-registration.steps.ts>

Mohamed Soliman
2021-09-08 05:04:48

@Mohamed Soliman has joined the channel

Mohamed Soliman
2021-09-08 05:06:18

Hello all, I am trying to clean my workspace a little. So, is there a tool or a cmd line that can let me know which steps of my step-defs file is no more used in feature files. I have been working on my posrtfolio for quite some time and I am sure there are a lot of steps are are no longer used. I need to clean them up. Can anyone suggest a solution

Mona Ghassemi
2021-09-08 05:14:18

*Thread Reply:* The low-tech way would be search for the step def in the repository and see if you get other matches (depending on what text editor / IDE you have, there is generally a way to do it).

Mohamed Soliman
2021-09-08 05:15:00

*Thread Reply:* this is very low-tech.. must be there’s a better option

Mohamed Soliman
2021-09-08 05:15:13

*Thread Reply:* But thank you for suggesting it anyway

👍 Mona Ghassemi
Mona Ghassemi
2021-09-08 05:16:23

*Thread Reply:* Yeah I understand if you have a lot of features / code it's not ideal! But now I'm curious too. 🙂

🙂 Mohamed Soliman
Aurélien Reeves
2021-09-08 05:43:34

*Thread Reply:* ~Maybe with some code coverage tool?~

Found that the usage formatter actually detect unused step definitsions

Aurélien Reeves
2021-09-08 05:48:35

*Thread Reply:* The usage formatter - built-in with cucumber-js - is actually able to report unused step definitions.

https://github.com/cucumber/cucumber-js/blob/main/src/formatter/usage_formatter_spec.ts#L33

https://github.com/cucumber/cucumber-js/blob/main/features/usage_formatter.feature#L8

🆒 Mona Ghassemi
Mohamed Soliman
2021-09-08 06:58:31

*Thread Reply:* it seems a good solution. Is there documentation for its usage from Docs or readme file?

David Goss
2021-09-08 07:31:57

*Thread Reply:* Formatter docs are a bit terse but I have some improvements in flight, see https://github.com/cucumber/cucumber-js/blob/docs-rework-formatters/docs/formatters.md#usage

David Goss
2021-09-08 07:32:35

*Thread Reply:* You probably want to use “dry run” at the same time so it doesn’t have to actually execute all your tests to find the usage

Mohamed Soliman
2021-09-08 07:44:00

*Thread Reply:* perfect… it’s a great solution for my case..

Mohamed Soliman
2021-09-08 07:44:03

*Thread Reply:* Thank you very much

Mohamed Soliman
2021-09-08 07:44:08

*Thread Reply:* Keep up the good work

Mark Shannon
2021-09-08 09:11:33

@Mark Shannon has joined the channel

ec-mark
2021-09-09 14:12:20

Hi folks, this is probably unusual, but... is it possible to override one of the build-in parameter types? defineParameterType({ name: "string", regexp: &lt;custom regex&gt;, transformer: &lt;custom transformer&gt;, }) trying it this way results in this error > Error: There is already a parameter type with name string

Duy Khánh Phạm
2021-09-09 19:17:24

@Duy Khánh Phạm has joined the channel

luke
2021-09-10 03:03:26

I'm 99% sure we don't have that functionality. We would probably want to add a "remove parameter type" and then create parameter type would work fine.

luke
2021-09-10 03:03:50

@ec-mark What is stopping you doing

defineParameterType({ name: "marks-string", regexp: &lt;custom regex&gt;, transformer: &lt;custom transformer&gt;, })

ec-mark
2021-09-10 07:11:55

Hey @luke, it's doable, but we have dozens of steps already and actually want this transformation to apply to every passed in string. We have some environment vars set within our platform, and we'd like to provide our testers an option to run a step like Given an HTTP request to "<http://%DOMAIN_NAME>%/api/info" this is just a basic example, but there several places where it'd be really useful for our tests to support those kinds of strings and use the string parameter type to search for %% wildcards and swap them with the associated environment variable

luke
2021-09-10 07:12:55

yes, so all you need to do is in your steps, just use {transformed-string}

luke
2021-09-10 07:13:27

Ctrl+R in any IDE to find and replace all instances of {string} for {transformed-string}

ec-mark
2021-09-10 07:13:41

okay, will try that out, thanks

luke
2021-09-10 07:13:57

you can then also have {domain-transformed-string} and {other-transformed-string}

luke
2021-09-10 07:14:22

for example I had one called suffixed-number that took something like 2nd or 5th and returned 2 or 5

ec-mark
2021-09-10 07:14:38

cool, sounds good

LayMui
2021-09-12 20:43:47

can I know how I can share datatable across the step definition with cucumber.js? for example in my When step When('{pronoun} requests weather forecast hourly', (actor: Actor, table: DataTable) =&gt; actor.attemptsTo( Log.the(table.hashes()[0].geocode), I like the table to be accessible in my Then step Then('{pronoun} should get the weather forecast details', async (actor: Actor) =&gt; ...

John Ringler
2021-09-12 22:34:35

*Thread Reply:* This can be achieved by storing locally what you need with localStorage. See https://github.com/lmaccherone/node-localstorage if you use Node which looks like it’s the case for you. So, in your first step definition, you would store each key/value pair in a local file using setItem(key, value). The name of the file is the key and the content of the file is the value (as a string). You can then access those key/value pairs in subsequent steps with getItem(key). And you can delete all localStorage files as part of your After(Scenario) hook. Note that everything in localStorage is saved as a string. So you might have to use JSON.parse whenever you need to access an object, an array, a boolean etc.

Stars
360
Language
CoffeeScript
Aurélien Reeves
2021-09-12 23:42:53

*Thread Reply:* You can use the world: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md

You can assign your datatable to the wold in your first step, then use it in further steps

matt-SmartBear
2021-09-13 13:12:04

*Thread Reply:* It looks like you're using a screenplay pattern implementation. Nice!

If you happen to be using https://github.com/cucumber/screenplay.js/ you can do it like this: https://github.com/cucumber/screenplay.js/#sharing-data-between-steps

If not, perhaps you can implement something similar in your implementation of the actor.

👍 LayMui
Jon Acker
2021-09-20 03:03:56

@Jon Acker has joined the channel

Jon Acker
2021-09-20 03:05:39

hi cucumer-js folks, does anyone know how I can get cucumber-js to read scenarios from a input stream rather than a file? and if this is not possible, how can I use the cumumber-js libraries to achieve this? (I want to run scenarios that are stored remotely and fetched via an api)

David Goss
2021-09-20 08:53:05

*Thread Reply:* This is a timely question! I’m currently working on https://github.com/cucumber/cucumber-js/issues/1711 to add a composable API to enable things like this. Would you mind dropping a comment on there with this use case and I’ll try and make sure it’s covered?

Assignees
davidjgoss
Labels
💔 breaking change, ⚡ enhancement
👍 Jon Acker
Jon Acker
2021-09-21 00:54:31

*Thread Reply:* looks like a great addition, would this allow to easily pipe the scenarios in or does it just allow to programatically run it giving it the names of feature files?

Jon Acker
2021-09-21 00:55:44

*Thread Reply:* is there a PR for this ?

David Goss
2021-09-24 01:14:19

*Thread Reply:* Sorry for late reply. There'll be a PR after this weekend. First pass might be simpler initially but the goal is to have it composable so one could e.g. pass in scenarios like you say. I'll keep you posted.

Dillon Barker
2021-09-20 06:31:10

Hey, I am looking to add some screenshots which I have captured to the built in cucumber/html-formatter. I want to add them after a scenario has failed etc. so they appear nicely in the feature dropdown of each failed test on the html report. Has anyone done similar to this?

luke
2021-09-20 07:48:24

attach will give you what you need @Dillon Barker

👍 Dillon Barker, MarkSweetlove
👍:skin_tone_2: matt-SmartBear
MarkSweetlove
2021-09-21 06:25:54

Good afternoon! I’m a little stuck on building a custom formatter. The envelope for testCaseStarted gives me testCaseId and id . How do i get the feature or scenario name from these? getTestCaseAttempt takes a testCaseStartedId and getPickle takes a pickleIdwhen using the EventDataCollector. Am i missing something?

matt-SmartBear
2021-09-21 07:47:41

*Thread Reply:* @Vincent Pretre is this a case for using gherkin-utils?

MarkSweetlove
2021-09-23 04:42:37

*Thread Reply:* I have the same problem in the afterStep hook. I have a testStepId but i can’t see any way to get the step keyword or text using that because in the hooks i don’t have access to the EventDataCollector.

Michael Morris
2021-09-21 13:06:39

Is it safe to call setWorldConstructor() in the beforeAll step?

Michael Morris
2021-09-21 13:11:51

Also, I was thinking on how to better leverage Background steps. The thought occurred to me of having an AfterBackground() hook that executes after all the background steps and before the scenario specific steps. That this would allow for is having the background steps put data into the world object, and then without having a step that specifically calls for processing on that data have that process occur before starting the scenario. Thoughts?

luke
2021-09-22 01:27:46

Better would probably be conditionally memoized methods. Because then that is better controlled and would flow better.

luke
2021-09-22 01:28:04

i.e. A user called Jeff exists -> Steps create this unless they exist, in which case they do nothing.

Michael Morris
2021-09-23 06:43:47

Where's an overview of changes between 7.0.0 and 7.3.1?

Aslak Hellesøy
2021-09-23 06:44:24

*Thread Reply:* In the changelog: https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md

Michael Morris
2021-09-23 06:45:31

*Thread Reply:* Thanks. I'm an idiot though, I asked this question then it immediately occurred to me to google for cucumber.js 7.3.1 changelong which gave your link as the 1st result 🙂

😆 Aslak Hellesøy
Michael Morris
2021-09-23 06:46:13

*Thread Reply:* ESM support is in core. Ok, I can rework my code to stop using the esm package.

Aslak Hellesøy
2021-09-23 06:47:27

*Thread Reply:* ESM support is still experimental

Aslak Hellesøy
2021-09-23 06:49:11

*Thread Reply:* We removed it in 7.2.1 - the change in 7.2.0 did not work. So 7.3.1 has no esm support AFAIK. People are still working on it.

Michael Morris
2021-09-23 06:53:41

*Thread Reply:* Ah. Ok.

Michael Morris
2021-09-23 06:53:58

*Thread Reply:* So continue using the ESM package I guess.

Michael Morris
2021-09-23 06:54:20

*Thread Reply:* I upgraded because Cucumber isn't reading it's profile or tag arguments off the command line.

Michael Morris
2021-09-23 06:54:36

*Thread Reply:* And that's probably due to my passthrough.

Michael Morris
2021-09-23 06:55:06

*Thread Reply:* See, I have a script that reads it's own arguments off the command line to config some things, then passes off control to cucumber.

Michael Morris
2021-09-23 06:55:14

*Thread Reply:* I need to revisit that.

Michael Morris
2021-09-23 07:04:59

Are there any known issues with cucumber being unable to read its arguments?

Aslak Hellesøy
2021-09-23 09:54:24

*Thread Reply:* Not that I know of @Michael Morris - got an example?

Michael Morris
2021-09-23 11:03:02

*Thread Reply:* I'm ok now - The problem lay in how golang mage relays arguments. Cucumber is just fine and is the least of my worries today.

om prakash
2021-09-23 20:42:47

Did anyone tried tagging in cucumber js. If i have just 1 tags its works but multiple doesnt work

Aurélien Reeves
2021-09-23 22:39:56

*Thread Reply:* Could you please give more info?

There is actually an issue that may be related: https://github.com/cucumber/cucumber-js/issues/1796#issuecomment-926318483

Do you experience the same?

om prakash
2021-09-23 22:41:20

*Thread Reply:* Yes its the same issue

Aurélien Reeves
2021-09-23 22:44:28

*Thread Reply:* As you can see, once everything is up-to-date, I was not able to reproduce the issue.

Would you have the possibility to provide a repo with a minimal reproduction example, and all the info regarding your execution environment? Versions of cucumber-js, node, and npm, os, and the shell?

om prakash
2021-09-23 22:45:32

*Thread Reply:* I am using cucumber with wdio. Would that work

om prakash
2021-09-23 22:45:55

*Thread Reply:* I can work on that

Michael Stelly
2021-09-27 08:38:10

@Michael Stelly has joined the channel

LayMui
2021-09-29 23:16:17

can cucumber.js work with the JS dotenv?

LayMui
2021-09-29 23:17:16

*Thread Reply:* I have create a file .env to set all my environment variables for staging. example: FARMERBASEURL=“https://farmer.stage.xx.io

LayMui
2021-09-29 23:17:39

*Thread Reply:* I want to set one for preprod FARMERBASEURL=“https://farmer.preprod.xx.io

LayMui
2021-09-29 23:18:26

*Thread Reply:* in my package.json, “test:execute”: “cucumber-js --tags=‘@test’“,

Aurélien Reeves
2021-09-30 00:26:38

*Thread Reply:* Did you required the "dotenv" package as part of your support code?

LayMui
2021-09-30 00:39:39

*Thread Reply:* yes in my step defn, I add this const dotenv = require('dotenv').config();

LayMui
2021-09-30 00:40:17

*Thread Reply:* then I call ChangeApiConfig.setUrlTo(process.env.FARMER_SERVICE_BASE_URL)

LayMui
2021-09-30 00:40:42

*Thread Reply:* what I need to be able to switch between 2 env. one for staging one for preprod

LayMui
2021-09-30 00:40:56

*Thread Reply:* wonder if cucumber.js can allow me to do this switch?

Aurélien Reeves
2021-09-30 01:51:48

*Thread Reply:* It seems this is not related to cucumber 🤔

What do you want to accomplish exactly?

Would you like to execute cucumber tests on both environment? Or do you want to execute the tests twice on the same environment but simulating different environments? Or something else?

👍 Mona Ghassemi
Mona Ghassemi
2021-09-30 06:44:40

*Thread Reply:* I do have the dotenv package but mostly I have ended up sourcing from different files, so it might be redundant at this point. It has nothing to do with cucumber; cucumber doesn't manage environment variables.

LayMui
2021-09-30 06:48:06

*Thread Reply:* ok thanks I got it resolved. using the NODE_ENV=stage cucumber.js …

👍 Mona Ghassemi
Dejan Ljaftov
2021-10-03 06:24:28

@Dejan Ljaftov has joined the channel

ec-mark
2021-10-04 17:38:20

Hi there, what's the default regex used to match strings? I couldn't find it in the repo

Aurélien Reeves
2021-10-04 23:19:11

*Thread Reply:* I guess you are using cucumber expressions The repo is there: https://github.com/cucumber/cucumber-expressions

You'll find some documentation, and a sandbox to test your expressions

Stars
11
Language
Java
ec-mark
2021-10-05 06:16:05

*Thread Reply:* ahhh perfect, thank you Aurélien!

LayMui
2021-10-05 19:38:09

in my feature file I have a few test scenarios if I have one that has a bug, how can I exclude it in the cucumber-js --tags command when running my test

LayMui
2021-10-05 19:38:29

*Thread Reply:* here is my feature file ```@all Feature: Get farmer details In order to get farmer details As a API farmer services consumer James James wants to get farmer details based on UserID   Background:     Given James is at the farmer services url  

  Rule: Get farmer detail using a valid unique UserID

    Scenario: Able to get farmer detail using userID       When he get a farmer using a UserID       Then he should able to get the details of the farmer

  Rule: Get farmer detail using an invalid unique UserID  @bug     Scenario: Able to get farmer detail using userID       When he get a farmer using a UserID       Then he should able to get the details of the farmer```

LayMui
2021-10-05 19:39:04

*Thread Reply:* when running the test, I have this line in my package.json NODE_ENV=stage cucumber-js --tags=all

LayMui
2021-10-05 19:39:20

*Thread Reply:* how can I exclude the test scenarios with the @bug tag?

Aurélien Reeves
2021-10-05 23:14:10

*Thread Reply:* --tags "not @bug"

https://cucumber.io/docs/cucumber/api/#tags

🙂

Gerald
2021-10-07 03:41:14

@Gerald has joined the channel

Arnold Epanda
2021-10-07 11:45:37

@Arnold Epanda has joined the channel

LayMui
2021-10-13 01:35:20

just like to check if I can use datatable in the following way?

LayMui
2021-10-13 01:35:26

*Thread Reply:* ```Rule: Unable to delete farmer from the database with invalid UserID

@test

Scenario: Unable to delete farmer from database with invalid UserID

  When he delete a farmer with an invalid UserID

    | invalidUserID |

    | 9ebea001-89df     |

    |  89df     |



  Then he should be unable to delete the farmer 

   | statusCode | errorMessage                                         |

   | 400        | Path variable 9ebea001-89df is not a valid UUID       |

   | 400        | Path variable 89df is not a valid UUID       |```
LayMui
2021-10-13 01:36:29

*Thread Reply:* that is the first row of the When steps will map to the first row of the Then steps, and so forth?

Aurélien Reeves
2021-10-13 02:41:14

*Thread Reply:* I think an example table would be more appropriate: https://cucumber.io/docs/gherkin/reference/#scenario-outline

```Scenario Outline: Unable to delete farmer from database with invalid UserID

When he delete a farmer with &lt;invalidUserId&gt;
Then he should be unable to delete the farmer 
And he shoud see &lt;errorMessage&gt;

Examples:
  | invalidUserId | statusCode | errorMessage |
  | 89df          | 400        | not valid    |```

Using datatables, you would have to keep the mapping between your steps by yourself.

LayMui
2021-10-13 03:56:58

*Thread Reply:* ok so the example I gave should still work as long as I have 2 rows for When and 2 corresponding rows for the Then steps? cos in case I have alot of parameter, I want to keep the When statement concise and brief

Aurélien Reeves
2021-10-13 04:53:30

*Thread Reply:* It would work. The order specified in the gherkin scenarios for datatables should be the same order in your step definitions

Tim Yao
2021-10-18 20:40:11

Is https://github.com/cucumber/cucumber-js/ the best repo to learn some real Cucumber.js implementation? Just trying to learn from some examples by looking at how others use it in real project. Or there are some public repos can be used as a good example?

Aslak Hellesøy
2021-10-19 05:25:40

*Thread Reply:* You could try https://school.cucumber.io to learn the basics

matt-SmartBear
2021-10-19 08:57:35

*Thread Reply:* https://github.com/smartBear/git-en-boite is a repo I worked on recently that uses Cucumber JS to drive the implementation. It's an HTTP service though, not a web app.

Stars
13
Language
TypeScript
matt-SmartBear
2021-10-19 09:00:39

*Thread Reply:* You can search GitHub for projects with Gherkin in them, not sure if / how you refine that just to TypeScript/JavaScript projects.

https://github.com/search?l=&q=language%3AGherkin&type=repositories

Tim Yao
2021-10-19 15:05:56

*Thread Reply:* @Aslak Hellesøy I have read a lot docs and tutorials(include https://school.cucumber.io) also used in my project. But feel most of the tutorials are too simple, like a hello world . When I start use it in a big scale project, I got too many questions.

matt-SmartBear
2021-10-19 15:11:54

*Thread Reply:* Ask the questions @Tim Yao! Then come back and answer other peoples' when they have them later!

Tim Yao
2021-10-19 15:12:36

*Thread Reply:* Thanks @matt-SmartBear for the sharing. The search language is a good idea, I will use it to explore other repos. 😁

matt-SmartBear
2021-10-19 15:13:15

*Thread Reply:* I would like to find other exemplars too

Tim Yao
2021-10-19 15:13:29

*Thread Reply:* Some opensource has a awesome … repo, list all projects used the product.

Tim Yao
2021-10-19 15:14:07

*Thread Reply:* for example https://github.com/vuejs/awesome-vue

Stars
62654
Last updated
an hour ago
matt-SmartBear
2021-10-19 15:14:18

*Thread Reply:* Yeah that would be good. It's always been quite rare finding open source projects that use Cucumber - so many are proprietary and in-house, but they are out there

matt-SmartBear
2021-10-19 15:14:21

*Thread Reply:* Let's start one!

Tim Yao
2021-10-19 15:14:55

*Thread Reply:* 👍:dancing_pickle:

Tim Yao
2021-10-19 15:15:02

*Thread Reply:* Happy to help

matt-SmartBear
2021-10-19 15:25:07

*Thread Reply:* I guess maybe there is already stuff like this in the docs, probably hideously out of date...

Tim Yao
2021-10-19 15:25:55

*Thread Reply:* https://github.com/virajkulkarni14/Awesome-Cucumber

Website
<https://git.io/Awesome-Cucumber>
Stars
29
Tim Yao
2021-10-19 15:26:15

*Thread Reply:* yes, found one, last update 3 year ago

matt-SmartBear
2021-10-19 15:26:43

*Thread Reply:* It's a start!

matt-SmartBear
2021-10-19 15:26:56

*Thread Reply:* If you want me to create a repo under the cucumber org for this, lmk

Tim Yao
2021-10-19 15:28:05

*Thread Reply:* Yes, as long as it helps that will be good. Thanks!

Tim Yao
2021-10-19 15:28:52

*Thread Reply:* For me, I think cucumber has a nice documentation site already, so mainly is for other resources.

Tim Yao
2021-10-19 15:29:23

*Thread Reply:* Like the example projects you gives above.

Tim Yao
2021-10-19 15:30:16

*Thread Reply:* And those most helpful presentation videos and books

Tim Yao
2021-10-19 15:31:13

*Thread Reply:* I also try to find time read your blog https://cucumber.io/blog/. It’s good place to learn as well.

Tim Yao
2021-10-19 15:32:34

*Thread Reply:* Please let me know when you got the repo set up 🙂 cheers

Cem
2021-10-22 20:30:35

@Cem has joined the channel

Cem
2021-10-22 20:37:36

Hi all. Can anyone recommend a github project that uses Javascript + selenium + cucumber extensively? I am trying to go beyond the tutorials offered in books / websites and more examples of real world usage

matt-SmartBear
2021-10-24 22:58:40

*Thread Reply:* I don't know of any public ones, sorry.

matt-SmartBear
2021-10-24 23:00:20

*Thread Reply:* Let's see if this trawls anything up https://twitter.com/mattwynne/status/1452515301396922368

twitter
Matt Wynne ✊🏿 (https://twitter.com/mattwynne/status/1452515301396922368)
👍:skin_tone_2: Jo Laing, Cem
Cem
2021-10-25 17:34:21

*Thread Reply:* Thanks a lot Matt

Cem
2021-10-28 10:32:16

Hi everyone,

Has anyone come across CancellationError in any of the scenarios? I have a total of 26 scenarios, but for some reason, I received CancellationError on my 2nd scenario, and all the remaining scenarios weren't executed at all.

Aslak Hellesøy
2021-10-28 12:28:12

*Thread Reply:* That’s not an error thrown by Cucumber, @Cem.

👍 Cem
Cem
2021-10-28 10:33:32

CancellationError: There was an uncaught error in the control flow: StaleElementReferenceError: stale element reference: element is not attached to the page document (Session info: chrome=93.0.4577.63)

matt-SmartBear
2021-10-28 19:48:24

*Thread Reply:* That's a WebDriver error.

https://developer.mozilla.org/en-US/docs/Web/WebDriver/Errors/StaleElementReference

It happens when you have a handle to an element, but by the time you run the code to interact with it, it's been deleted from the page.

developer.mozilla.org
👍 Cem
Cem
2021-10-28 19:57:53

*Thread Reply:* Thanks for the answer Matt

Michael Morris
2021-10-28 14:18:51

Hmm, apparently calling setWorldConstructor more than once doesn't work.

Michael Morris
2021-10-28 14:19:14

Or is it not allowed from BeforeAll ?

matt-SmartBear
2021-10-28 19:49:20

*Thread Reply:* It sounds plausible that you can't call it more than once. What's the error that you see?

David Goss
2021-10-29 00:04:36

*Thread Reply:* You can't call setWorldConstructor from hooks

Mona Ghassemi
2021-10-29 07:17:58

In an afterScenario, what variable do I use to see if the test passed? I am trying to integrate with Browserstack and they have the following snippet for webdriverIO (to tell browserstack the test passed or failed); however this is not with cucumber (I'm using webdriverIO with cucumber 🥒 ). afterTest: function (test, context, { error, result, duration, passed, retries }) { if(passed) { browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": ""}}'); } else { browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": ""}}'); } }

Mona Ghassemi
2021-10-29 07:30:57

*Thread Reply:* I will try "if(success)" https://cucumber.io/docs/cucumber/api/

luke
2021-10-29 07:47:14

I had the same issue. You can't. Sadly.

luke
2021-10-29 07:47:36

As such you need to code your own thing. I wrote a singleton class that by default had the value as passed, and then if any test failed it updated the value to failed.

Mona Ghassemi
2021-10-29 07:50:45

*Thread Reply:* how did it know the test failed? 🙂

luke
2021-10-29 07:51:53

*Thread Reply:* in each after hook you interrogate the state.

Mona Ghassemi
2021-10-29 07:55:17

*Thread Reply:* after instead of afterScenario?

Mona Ghassemi
2021-10-29 07:55:35

*Thread Reply:* afterStep?

luke
2021-10-29 08:28:12

*Thread Reply:* not sure what it's called in JS. It occurs after each scenario.

Mona Ghassemi
2021-10-29 09:48:13

*Thread Reply:* Ok. But what I need to know is how do I interrogate the state?

Cucumber adds green checkmarks to steps that passed. Red x to the ones that failed, etc.

So there must be some way to access the pass / failed state?

Mona Ghassemi
2021-10-29 09:59:28

*Thread Reply:* I tried with if (scenario.isFailed()) { however I get this error: [0-0] 2021-10-29T16:58:23.360Z ERROR @wdio/utils:shim: TypeError: scenario.isFailed is not a function

Mona Ghassemi
2021-10-29 09:59:55

*Thread Reply:* afterScenario: function (scenario, world) { if(scenario.isFailed()) { ... }

Mona Ghassemi
2021-10-29 10:22:36

*Thread Reply:* Ok I realize it might be more WebdriverIO that I need to deal with https://webdriver.io/docs/configurationfile/

Looks like there is an optional "result" param; will try that

afterScenario: function (world, result) {

webdriver.io
Mona Ghassemi
2021-10-29 10:51:03

*Thread Reply:* still nothing 😞

luke
2021-11-01 01:28:51

*Thread Reply:* no you had it before. scenario.isFailed

luke
2021-11-01 01:28:59

*Thread Reply:* you should also be able to get the verbose status

luke
2021-10-29 07:47:43

then in your exit hook, you fire the api request to BStack

luke
2021-10-29 07:49:14

cc/ @Mona Ghassemi

Cem
2021-11-04 09:06:51

Hi everyone,

On cucumber 6 I was using HookScenarioResult as a parameter for my after function to retrieve scenario names. What do i need to use on cucumber 7.3.1?

luke
2021-11-04 09:38:16

scenario name is no longer present in the pickle. as such you cannot access it. Whilst this has been a bit of friction, it's likely to not go away any time soon

luke
2021-11-04 09:38:51

See here for more info / discussion (Different flavour, but same principle)

https://github.com/cucumber/cucumber-ruby/issues/1432

Labels
💔 breaking change
Comments
25
luke
2021-11-04 09:41:00

The JS variety is here: https://github.com/cucumber/cucumber-js/issues/1740

Labels
good first issue, 🐛 bug
Comments
9
Cem
2021-11-04 10:47:23

Thanks a lot for the reply

matt-SmartBear
2021-11-04 12:24:02

What do you need it for @Cem?

Cem
2021-11-04 12:26:35

@matt-SmartBear We are using lambdatest for automation. I would like to assign my test scenario names to lambdatest name to differentiate which test failed which test passed on lambdatest dashboard

matt-SmartBear
2021-11-04 12:48:11

Well it looks from https://github.com/cucumber/cucumber-js/pull/1775 like there might be some light at the end of the tunnel.

Comments
1
matt-SmartBear
2021-11-04 12:48:54

Are you able to try the v8 release candidate? https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md#800-rc1---2021-10-19

Cem
2021-11-04 12:54:33

I will try bumping up to 8

Cem
2021-11-04 12:54:38

Thank you

Fulvio Carvalhido
2021-11-17 00:59:13

@Fulvio Carvalhido has joined the channel

huseyin altas
2021-11-22 10:01:15

@huseyin altas has joined the channel

Eduardo Castro
2021-11-22 10:12:46

@Eduardo Castro has joined the channel

Eduardo Castro
2021-11-22 10:13:47

Hello everyone! I have one question about the why cucumber.js not included Gherkin keywords AND, BUT ?

Aslak Hellesøy
2021-11-22 10:15:54

@Eduardo Castro none of the Cucumber implementations do. An And or a But is just syntactic sugar for not repeating Given, When or Then.

Aslak Hellesøy
2021-11-22 10:17:06

Logically, and And or But step is one of GivenWhen or Then.

👍 Eduardo Castro
LayMui
2021-11-23 01:26:58

can I combine Scenario Outline/examples with datatable ?

LayMui
2021-11-23 01:27:21

*Thread Reply:* ```Feature: Button Event Handling In order to validate Button event handling As a QA tester Jan Jan wants to see how the ahua button event behave

Background: 
  Given Jan is at the app

Scenario Outline: Ahua Button Event Change title When he want to trigger button event to change the button title | event | | onPress | Then he is able to see the button title changed "<title>" Examples: | title | | buttonTitle |```

Aurélien Reeves
2021-11-23 01:45:22

*Thread Reply:* You can use both scenario outline and datatable in the same scenario.

But they won't be automatically "combined" as you would like as I presume from your sample. You would have to program it by yourself.

However, in your case, why couldn't your writte the following?

```Feature: Button Event Handling In order to validate Button event handling As a QA tester Jan Jan wants to see how the ahua button event behave

Background: 
  Given Jan is at the app

Scenario Outline: Ahua Button Event Change title When he want to trigger button <event> to change the button title Then he is able to see the button title changed "<title>" Examples: | event | title | | onPress | buttonTitle |```

Luděk Nový
2021-11-25 00:18:30

Hello. Is there an easy way to get the examples for current test run in before hook? I was trying to parse if from the testCase.picke.steps , but it seems that for some scenarios they are not there 🤷 .

Aurélien Reeves
2021-11-25 01:19:10

*Thread Reply:* A test case is the result of a scenario being transformed as a test. A scenario with N examples will result in N test cases. The test case is an example.

The Before hook is executed before each test case, not before each scenario.

Thus the before hook has no access to other examples of the scenario than the one it has been calling for.

Does that help?

Luděk Nový
2021-11-25 01:22:23

*Thread Reply:* @Aurélien Reeves thanks for the explanation. Yeah, I get that, but I find it a bit tricky to get the "examples" for current test case.

Currently exploring the astNodeIds to match them with ids in gherkinDocument

Aurélien Reeves
2021-11-25 01:23:51

*Thread Reply:* What do you call "examples" for the current test case?

Aurélien Reeves
2021-11-25 01:24:25

*Thread Reply:* There are no "examples" for a test case: a test case results from a single example of the scenario outline

Aurélien Reeves
2021-11-25 01:26:00

*Thread Reply:* What are you trying to achieve?

Luděk Nový
2021-11-25 01:27:33

*Thread Reply:* Ok, I am trying to get the "examples" inputs (the table data) for each test case as I have a logger and need to distinguish the different test runs of the same scenario outline.

Luděk Nový
2021-11-25 01:32:36

*Thread Reply:* made it work like this: ```const parseExamples = (testCase: ITestCaseHookParameter) => { const examplesMap = new Map() const scenarioId = testCase.pickle.astNodeIds[0] const exampleId = testCase.pickle.astNodeIds[1] const scenario = testCase.gherkinDocument.feature.children.find((child) => child.scenario.id === scenarioId) const cells = scenario.scenario.examples[0].tableHeader.cells const values = scenario.scenario.examples[0].tableBody.find((body) => body.id === exampleId)

cells.forEach((cell, index) =&gt; {
    examplesSet.set(cell.value, values.cells[index].value)
})
return examplesMap

}`` but not sure if the order ofastNodeIds` is guaranteed and if there could be more ids in some cases?

Aurélien Reeves
2021-11-25 02:12:17

*Thread Reply:* I see. You want the row in the table which has been used to generate the test case? Not all the rows?

I guess your snippet should work well indeed

Luděk Nový
2021-11-25 02:14:17

*Thread Reply:* Yes, thats it, sorry for not using the exact terms 😉 It works fine it seems , it was just missing a couple of optional chaining to avoid failures for non-scenario outlines.

👌 Aurélien Reeves
matt-SmartBear
2021-11-25 07:54:00

*Thread Reply:* Yeah this API is awkward at the moment

Luděk Nový
2021-11-25 07:55:13

*Thread Reply:* @matt-SmartBear it's just not super user friendly, took me a while to comprehend it.

matt-SmartBear
2021-11-25 07:55:35

*Thread Reply:* In Ruby, I think we wrap this raw test case object with a facade that has some more helpful stuff on it. We could consider doing that for JS too.

👍 Luděk Nový
matt-SmartBear
2021-11-25 07:55:53

*Thread Reply:* (and put some API docs somewhere!)

matt-SmartBear
2021-11-25 07:56:21

*Thread Reply:* @Luděk Nový what would the API have looked like here, in an ideal world? Could you sketch out some code?

Luděk Nový
2021-11-25 08:00:32

*Thread Reply:* Thats a tough question, but for the above described use case, ideally it would not be necessary to iterate so many times, eg, exposing the example values in pickle object or something. and I did not find any docs for it, eg whether the order of astNodeIds is guaranteed, of there could be more then 2 items in the array and so on.

matt-SmartBear
2021-11-25 08:03:36

*Thread Reply:* So something like this perhaps?

Before((scenario: RunningScenario) =&gt; { console.log(scenario.exampleRow?.cells) })

Luděk Nový
2021-11-25 08:15:55

*Thread Reply:* yes! that would be much easier to use than the current api 🙂

matt-SmartBear
2021-11-25 11:03:12

*Thread Reply:* OK I raised an issue so we can start the process of making this happen: https://github.com/cucumber/cucumber-js/issues/1851

❤️ Luděk Nový
matt-SmartBear
2021-11-25 11:03:35

*Thread Reply:* @Luděk Nový if you'd be interested in working on a contribution for it I'd be happy to support you with it.

matt-SmartBear
2021-11-25 11:04:01

*Thread Reply:* It should be a fairly straightforward change, and super useful

Luděk Nový
2021-11-25 11:05:08

*Thread Reply:* @matt-SmartBear Thanks, sounds good!

Michael Morris
2021-11-30 07:22:24

So, in 8.0.0 how do you activate esm modules? I don't see anything obvious. I'm trying to get away from using the npm esm package as a shim to convince it to work.

Michael Morris
2021-11-30 08:18:17

*Thread Reply:* This works but it's ugly: "node -r esm node_modules/@cucumber/cucumber/bin/cucumber-js"

Michael Morris
2021-11-30 08:18:53

*Thread Reply:* And I'm not sure it will work with parallel mode.

Michael Morris
2021-11-30 09:14:16

K, got cucumber.js to work as a module file without rewriting cucumber. export default ""; export const altProfile1 = `args as normal here`; export const altProfile2 = `args as normal here`;

Michael Morris
2021-11-30 09:15:01

That also passes lint rules (eslint doesn't like there not being a default). This isn't in the current documentation, how would I go about adding it?

Michael Morris
2021-11-30 09:53:22

Can --world-parameters be passed multiple times?

Michael Morris
2021-11-30 09:54:47

*Thread Reply:* Yes.. (I should have read the docs. Sorry)

Aurélien Reeves
2021-12-01 01:00:06

@Michael Morris there is actually nothing to do to activate esm modules. It should just work out of the box within a project which uses ESM.

I've just pushed an example here: https://github.com/aurelien-reeves/cucumber-js-esm-example The project is a node module using ESM. The support code also uses ESM without any specific configuration. Please just note the use of a common-js configuration file: this is a current limitation of cucumber-js as explained at the bottom of the following document: https://github.com/cucumber/cucumber-js/blob/main/docs/esm.md

Language
JavaScript
Last updated
2 minutes ago
Michael Morris
2021-12-01 05:48:43

Ok, I didn't need to do a cucumber .cjs file. As pointed above the file can be done in module format and it will work. There are still problems when running cucumber within a module though. I blame the node team for this - frankly the node rollout of es6 support is attrocious.

Aurélien Reeves
2021-12-01 06:05:12

*Thread Reply:* Actually your cucumber.js file is working as a module because of your hack.

Your hack load cucumber itself as a module, which it is not. I would encourage you to try removing your hack and using a .cjs file for the configuration. Everything else should work properly using esm imports / exports.

Michael Morris
2021-12-01 06:12:57

*Thread Reply:* They don't though. I tried that first - path of least resistance and all.

Michael Morris
2021-12-01 06:13:48

*Thread Reply:* I'm in an odd situation. I have a client extending library of cucumber that adds API services emulation for tests that is imported as a module by the actual projects that have the critical system tests.

Michael Morris
2021-12-01 06:14:14

*Thread Reply:* The reason for this structure is there are multiple projects that need to import this library.

Michael Morris
2021-12-01 06:15:05

*Thread Reply:* Those projects exist as esm modules for... reasons. (Testing did not exist at the beginning of the project and I'm struggling to bring it in).

Michael Morris
2021-12-01 06:16:28

*Thread Reply:* I could extract my hack out to a tiny project - cucumber-esm. The ESM package smooths over a lot of node's mistakes with ES6.

Michael Morris
2021-12-01 06:37:06

*Thread Reply:* Thank you for your time on this though.

Aurélien Reeves
2021-12-01 06:52:56

*Thread Reply:* I am not sure to get it actually 😓

Do you think you could setup a minimal reproducible example in a dedicated new repository?

That way we could have a deeper look inside the issue you are facing, that may help us improving esm support

Michael Morris
2021-12-01 06:53:26

*Thread Reply:* Be happy to. Give me a day or two.

Aurélien Reeves
2021-12-01 06:56:26

*Thread Reply:* Amazing! Thanks!

And no worries for the delay :)

Michael Morris
2021-12-01 05:49:37

I'll keep using my ugly script line hack, everything else works great.

Michael Morris
2021-12-01 06:00:27

Here's a documentation pull request for what I suggest. https://github.com/cucumber/cucumber-js/compare/main...michaelm-rsi:patch-1

Aurélien Reeves
2021-12-01 06:06:06

*Thread Reply:* Well, this is too specific, and requires your script hack to work. So we won't be able to merge this as-is, sorry.

Michael Morris
2021-12-01 13:50:16

I'm curious as to how the new runCucumber API will accomplish this code block (Thread)

Michael Morris
2021-12-01 13:50:24

*Thread Reply:* ```async function runCucumberTest(args, expectError = false) { return new Promise((resolve) => { const allArgs = ["run", "self", "--", "--site", webserverPath].concat(args); const runner = spawn( /^win/.test(process.platform) ? "npm.cmd" : "npm", allArgs, { // Uncomment next line to pass inner test's output to console. Do this // only when debugging this script. // stdio: "inherit", env: { ...process.env }, } );

runner.on("exit", (code) =&gt; {
  if (expectError &amp;&amp; code) {
    resolve("pass");
  } else if (expectError &amp;&amp; !code) {
    throw new Error("Expected test to fail and it did not");
  } else if (!expectError &amp;&amp; code) {
    throw new Error("Test failed unexpectedly");
  } else if (!expectError &amp;&amp; !code) {
    resolve("pass");
  } else {
    throw new Error("This code should be unreachable");
  }
});

}); }```

Michael Morris
2021-12-01 13:50:57

*Thread Reply:* To be clear, the code above works fine - it's my current work around on the lack of a true runner setup.

Michael Morris
2021-12-01 13:51:48

*Thread Reply:* My world object has an AfterAll hook that scans the browser console for errors. If it finds any, it fails the test immediately.

Michael Morris
2021-12-01 13:52:07

*Thread Reply:* I need to test that hook and this is what I came up with to insure it would fail on cue.

Michael Morris
2021-12-01 14:36:39

Any tutorials on using cucumber logging? I'd like to use it, but I need to see it's output. Currently I'm using npm's logger.

Aurélien Reeves
2021-12-01 22:52:28

*Thread Reply:* What do you mean by "cucumber logging"?

Did you noticed the following: https://github.com/cucumber/cucumber-js/blob/f37edaadbefea557d87ef5f19bc301a277ac4264/docs/support_files/attachments.md#logging?

Michael Morris
2021-12-01 15:02:40

I've tried with and without the prettier format and the log messages aren't showing. What's the point of a logger if you can't see it's output?

Michael Morris
2021-12-01 15:02:48

This isn't well documented at all.

Michael Morris
2021-12-01 16:11:32

Are the available format-options for any formatter documented anywhere?? SMH

Aurélien Reeves
2021-12-01 23:11:35

*Thread Reply:* It relies on the formatters to document their options.

For built-in formatters, the option that is well documented is the one to disable colors for outputs to the terminal.

There is also the customization of snippets which uses those options. This is documented here: https://github.com/cucumber/cucumber-js/blob/c3a33139366a205d12e4e707eead75ae2ae1d2d8/docs/snippets.md

David Goss
2021-12-01 16:40:21

@David Goss has left the channel

Michael Morris
2021-12-03 16:21:39

I'd like to generate the following feature in code rather than have it in my features directory. Feature: @dev Scenario: Development and demo preset Given Development

Michael Morris
2021-12-03 16:23:04

The step definition configures the mock server and cookies, then the developer can manually work with the data while developing. It isn't in and of itself a feature.

Michael Morris
2021-12-03 16:26:30

(If anyone is wondering why this even works, I have a global after step that pauses the runner between runs when the system is in debug mode - waiting for input from the command line. So they can run this "feature" and the system will stay paused after parsing the given indefinitely while they play with the browser and the data they created.)

Kevin Choi
2021-12-08 06:29:40

@Kevin Choi has joined the channel

Joe A
2021-12-08 11:23:23

@Joe A has joined the channel

Joe A
2021-12-08 11:30:30

I’m trying to disable this message but I can’t find where to create the cucumber.js file.

Aurélien Reeves
2021-12-08 14:30:52

*Thread Reply:* You can create a cucumber.js file in the root folder of your project, next to your package.json file

Joe A
2021-12-08 14:31:32

*Thread Reply:* When I tried that it continued to print the message. Is there another step included?

Aurélien Reeves
2021-12-08 14:36:24

*Thread Reply:* That is weird Can you paste the content of your cucumber.js file, and the script you use to run your tests ?

Joe A
2021-12-08 14:37:42

*Thread Reply:* I had a typo in cucumber -_- I’m sorry, that did work after all

Aurélien Reeves
2021-12-08 14:39:20

*Thread Reply:* No worries! I am glad you made it work after all 😁

jradom
2021-12-08 11:32:02

We use Cypress and Cypress Cucumber pre-processor. Just wonder is it possible to see (programmatically) scenario tags inside a steps of that scenario?

Aurélien Reeves
2021-12-08 23:46:46

*Thread Reply:* May I ask: what are you trying to achieve?

I am not sure we can know tags on a scenario from within a step directly. You may have to implement a specific world to do that.

I don't know if that may help, but you may have access to those tags from beforeStep and afterStep hooks.

Documentation for the "world": https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md

Documentation for hooks: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/hooks.md#beforestep--afterstep

More documentation in the api reference: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/api_reference.md#afterstepoptions-fn

luke
2021-12-09 01:00:23

*Thread Reply:* Best way (Using my cucumber analogy), is you create an info class (in js probably an object), that you inject at world creation time (So from your hooks), then access this object inside your step invocation

plocket
2021-12-12 10:52:33

*Thread Reply:* [Sorry, don’t have time to look at the previous comment’s links.] We definitely do it in Before(), which comes just before the Scenario runs. Here’s some sample code: Before(async (scenario) =&gt; { let scenario_name = scenario.pickle.name; }

Manuela Mag
2021-12-09 01:39:34

@Manuela Mag has joined the channel

Manuela Mag
2021-12-09 01:43:50

Hello, I was wondering if you could help me with this. I'm clone the repo hps-cucumber-javascript and notice that the tests can be seen only in the extern feature file. Can the structure be changed ? I was wondering if we could have the project structure like this : src/app and src/test, src/test containing both features and glue.

Aurélien Reeves
2021-12-09 02:07:31

*Thread Reply:* Hi 🙂

I guess you can have the structure as you want:

• move the app itself from src to src/app • edit ./cucumber-js.conf output_directory from ./features to ./src/test • update ./features/actionwords.js to properly require the app from ./src/app rather than ./src • update the call to cucumber-js to let him know where to find features and step definitions Beside that, may I ask:

• why are you using hps-cucumber-javascript? • did you noticed that it is set-up with a pretty old version of cucumber? I would encourage to update your fork to work with latest version of cucumber-js. That may certainly require a lot of fix and customization.

Manuela Mag
2021-12-09 02:11:32

*Thread Reply:* Thank you for your reply! 🙂 I'm new with cucumber-js, I saw that template and I'm trying to see how it works.

Aurélien Reeves
2021-12-09 05:01:53

*Thread Reply:* Are you also a user of cucumber studio or hiptest publisher?

Manuela Mag
2021-12-09 05:08:05

*Thread Reply:* Yes

Aurélien Reeves
2021-12-09 05:28:44

*Thread Reply:* Ok, thanks 👌

Shubhakiran
2021-12-09 07:16:06

@Shubhakiran has joined the channel

plocket
2021-12-12 11:09:33

Does someone know how I can capture the text cucumber outputs into the command prompt console at various stages? For example, the progress output, the error messages, and the final success/failure logs. I’m making a report and I’d like to include that output in the report.

matt-SmartBear
2021-12-13 07:29:26

*Thread Reply:* If you want to grab those pieces separately you'd need to write your own custom formatter.

matt-SmartBear
2021-12-13 07:29:52

*Thread Reply:* There's an example of that here: https://github.com/cucumber/cucumber-js/blob/main/features/custom_formatter.feature

matt-SmartBear
2021-12-13 07:31:27

*Thread Reply:* If you have a look at the source for the ProgressFormatter (https://github.com/cucumber/cucumber-js/blob/main/features/custom_formatter.feature) you should get some clues.

matt-SmartBear
2021-12-13 07:31:31

*Thread Reply:* Does that help?

plocket
2021-12-16 05:49:26

*Thread Reply:* Thanks, we’ll check it out and give it a shot. Seems more needs to go into it than we thought, so it may take us a little while, but thanks for the pointers 👍

Tim Yao
2021-12-13 22:30:28

Does any one has cucumber.js integrated with a test case management system? Any of them has easy to use integration? zephyr? xray? Our team is looking at TesRail at the moment and I worried it won’t be a good option for cucumber to work with.

Aurélien Reeves
2021-12-13 23:29:37

*Thread Reply:* Hello Tim,

The zephyr products have integration with Cucumber.

Zephyr, among other, are Smartbear products. And as you may know, Cucumber is supported by Smartbear too.

We have dedicated teams dedicated on integrating BDD and Cucumber into Zephyr. That team is really close to us at Cucumber Open.

Tim Yao
2021-12-14 01:49:20

*Thread Reply:* Yes, I know, as they are all in Smartbear, I assume they can integrated better than others. Is there any code example or demo video for cucumber-js Zephyr integration? I only see one for Java https://github.com/SmartBear/zephyr-scale-cucumber-integration-example

Aurélien Reeves
2021-12-14 02:15:26

*Thread Reply:* At first, which Zephyr are you talking about? Zephyr scale, squad or enterprise? Those are 3 different products actually.

Then I'll be able to look for someone to give you more accurate help 🙂

Tim Yao
2021-12-14 02:48:22

*Thread Reply:* Zephyr scale I think. But sad Zephyr is not even on our QA’s list 😅

matt-SmartBear
2021-12-14 09:02:26

*Thread Reply:* @tooky can you help us find the right person?

tooky
2021-12-14 09:04:49

*Thread Reply:* @David Lechevalier?

David Lechevalier
2021-12-15 01:04:20

*Thread Reply:* Hi Tim! So both Zephyr Scale and Squad propose an integration for cucumber. Both rely on a call to an api endpoint to upload your results. In scale it is here: https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Automations. You either use the tag as described in the example you mentioned, or Scale will create your test cases on the fly if they do not exist yet in the library. Squad behaves the same way: https://support.smartbear.com/zephyr-squad-cloud/docs/test-automation/index.html even tho it is a bit more complex to create the task.

David Lechevalier
2021-12-15 01:05:46

*Thread Reply:* In scale, your scenario results will look like this: https://app.getbeamer.com/zephyrscale/en/better-visualization-of-your-cucumber-results

app.getbeamer.com
Tim Yao
2021-12-15 01:11:42

*Thread Reply:* Thanks @David Lechevalier, that’s really helpful. For API, is there an integration plugin/addon for cucumber-js to use directly? Or I need to write by my own.

David Lechevalier
2021-12-15 02:07:08

*Thread Reply:* No direct integration. You need to to somethnig like this: curl -X POST <https://api.zephyrscale.smartbear.com/v2/automations/executions/cucumber>\?projectKey\=${PROJECT_KEY}\&amp;autoCreateTestCases\=true \ -H "Authorization: Bearer ${ZSCALE_TOKEN}" \ -F "file=@results.zip" Woith the project key being the key of your jira project and the ZScale token being the authentication token you get from Zephyr Scale. The zip files include the results of your execution as json files

Tim Yao
2021-12-15 02:08:40

*Thread Reply:* Got it. Thanks. I will take some time to have a look at them. 👍

matt-SmartBear
2021-12-15 12:41:09

*Thread Reply:* Thanks @David Lechevalier!

💪 tooky
David Lechevalier
2021-12-15 13:38:35

*Thread Reply:* np 😉

David Lechevalier
2021-12-14 09:04:54

@David Lechevalier has joined the channel

Fulvio Carvalhido
2021-12-15 02:00:51

Hi there guys 😄

Fulvio Carvalhido
2021-12-15 02:01:06

Is there a way to exclude an tag in the hooks?

Fulvio Carvalhido
2021-12-15 02:01:10

like this..

Fulvio Carvalhido
2021-12-15 02:01:45

Before({tags: "!@foo"}, function () { // This hook will be executed before scenarios tagged with @foo }); Exclude tag @foo

Tim Yao
2021-12-15 02:19:44

*Thread Reply:* Before({tags: "not @foo"}, function () { // This hook will be executed before scenarios tagged with @foo });

Mona Ghassemi
2021-12-15 05:46:09

*Thread Reply:* I don't think the comment says what you want it to say

😀 matt-SmartBear
Fulvio Carvalhido
2021-12-15 06:54:24

*Thread Reply:* @Tim Yao thanks that's it.....

😁 Tim Yao
🎉 matt-SmartBear
miguelms
2021-12-15 06:54:48

@miguelms has joined the channel

LayMui
2021-12-22 00:48:16

I keep getting ✗ Error: function timed out, ensure the promise resolves within 5000 milliseconds in headless mode. where can I adjust this timeout? I am using the serenityjs, webdriverio and cucumber framework https://github.com/serenity-js/serenity-js-cucumber-webdriverio-template

Stars
3
Language
TypeScript
LayMui
2021-12-22 00:48:57

*Thread Reply:* ```Caused by: Error: Wait timed out after 5s

[test:stage:execute] at xx/node_modules/webdriverio/build/commands/browser/waitUntil.js:66:23

[test:stage:execute] at async Browser.wrapCommandFn (xxx/node_modules/@wdio/utils/build/shim.js:131:29)

[test:stage:execute] at async World.<anonymous> (/xxx/src/step-definitions/createCredential.steps.ts:```

Joe A
2021-12-22 08:47:35

*Thread Reply:* seems like a webdriver thing. I’m not familiar with webdriver, but I use Cypress and there is a custom config you can pass to extend the wait time

Joe A
2021-12-22 09:11:35

*Thread Reply:* yeah same in webdriver https://webdriver.io/docs/api/browser/waitUntil

webdriver.io
plocket
2021-12-23 12:30:35

I’m using a node script to run my cucumber test file: "cucumber_base": "./node_modules/.bin/cucumber-js --require ./lib/index.js", I’d like to take ./node_modules/.bin/cucumber-js out and just require it in one of the files. Is that actually possible with an executable like that?

Tim Yao
2021-12-23 16:44:34

*Thread Reply:* Hi @plocket I guess you want to run Cucumber-js in a programmatic way. I found an open issue https://github.com/cucumber/cucumber-js/issues/1711 and looks like they are working on it for v8 but no public API yet.

Assignees
@davidjgoss
Labels
⚡ enhancement
✅ plocket
Tim Yao
2021-12-23 16:47:44

*Thread Reply:* @plocket Here is an example how Nightwatch.js v2 uses cucumber cli in their js file https://github.com/nightwatchjs/nightwatch/blob/main/lib/runner/test-runners/cucumber.js Not sure if it’s a best practice. But maybe can help you, just copy it.

👀 plocket
Manuela Mag
2021-12-27 09:33:02

Hello, i was wondering if you could help me. I'm facing a problem while trying to complete a step "Checking if the email and password fields are in the default state after refreshing page".  This is how i'm checking if the fields are containing any text: this.driver.wait(until.elementLocated(this.elements.emailPlaceHolder)); this.driver.findElements(this.elements.emailPlaceHolder) .then(function() { expect(this.elements.emailPlaceHolder.getAttribute("value")).to.equal(''); }); But I'm getting this error: "TypeError: Cannot read property 'wait' of undefined", even if I'm using directly the by.css, not a variable, in the wait function.

Joe A
2021-12-27 09:34:10

*Thread Reply:* which driver are you using?

Joe A
2021-12-27 09:34:29

*Thread Reply:* Either way it looks like this.driver is undefined.

Manuela Mag
2021-12-27 09:34:45

*Thread Reply:* chrome driver, version 96

Joe A
2021-12-27 09:36:11

*Thread Reply:* From the small amount of information this is an error from the driver, not the selector.

Manuela Mag
2021-12-27 09:57:45

*Thread Reply:* I tried to add a new declaration for driver : his.driver = new selenium.Builder().withCapabilities({    browserName: 'chrome', javascriptEnabled: true, acceptSslCerts: true, chromeOptions: { args: ['start-maximized', 'disable-extensions'] }, // path: chromedriver.path }).build(); but it throws the same error. Is there a better way initialize the driver? In the other steps the wait and findElements work with no initialization for the driver

Joe A
2021-12-27 09:59:40

*Thread Reply:* What happens if you console.log(this.driver) right before the original code?

Joe A
2021-12-27 10:00:30

*Thread Reply:* Silly question, but are you using this inside of an arrow function eg: () =&gt; {/****code here****/}

Manuela Mag
2021-12-27 10:02:40

*Thread Reply:* I'm getting an undefined for the driver with console.log

Manuela Mag
2021-12-27 10:03:50

*Thread Reply:* This is the function : checkEmptyEmailAndPassword: function () { driver.wait(until.elementLocated(this.elements.emailPlaceHolder)); driver.findElements(this.elements.emailPlaceHolder) .then(function() { expect(this.elements.emailPlaceHolder.getAttribute("value")).to.equal(''); next(); }); }

Joe A
2021-12-27 10:06:45

*Thread Reply:* I’m not sure. Seems like a Selenium issue though. If you’re using the driver.wait function elsewhere I’d compare those calls to this one.

Joe A
2021-12-27 10:07:22

*Thread Reply:* I’ve used selenium in the past, and I recommend cypress because their docs are easier to read and better maintained.

Manuela Mag
2021-12-27 10:08:48

*Thread Reply:* in some places i've noticed that findElement() sents an object with the promise instead of the webElement. Could it be an issue with the driver ?

Manuela Mag
2021-12-27 10:09:21

*Thread Reply:* Thanks, i would try cypress :)

Joe A
2021-12-27 10:09:52

*Thread Reply:* Yes it looks like they use await on selenium

Joe A
2021-12-27 10:10:35

*Thread Reply:* But in their case, they are declaring the findElement then awaiting the response. You are just having an issue with driver not being defined

Manuela Mag
2021-12-27 10:29:59

*Thread Reply:* Thank you for your reply! I will try what you suggested

Joe A
2021-12-28 10:07:30

Does anyone know how I can enable the built in html file?

Joe A
2021-12-28 10:08:06

*Thread Reply:* I thought something like this would work, but no luck

Aslak Hellesøy
2021-12-28 14:05:14

*Thread Reply:* @Joe A try { default: “--publish-quiet --format html:path/to/report.html” }

🙌 Joe A
Aslak Hellesøy
2021-12-28 14:05:20

*Thread Reply:* Also see https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md

Manuela Mag
2022-01-05 01:55:57

Hello, I've seen here https://cucumber.io/docs/cucumber/mocking-and-stubbing-with-cucumber/ that it's possible to mock a server with cucumber-js. I was wondering if you could tell me which framework would be better?

Aurélien Reeves
2022-01-05 02:14:42

*Thread Reply:* As explained in the doc, it really depends on your actual stack and needs.

What do you need to achieve? Which kind of server do you need to mock?

Manuela Mag
2022-01-05 02:23:39

*Thread Reply:* I want to test the front end of an application, and I need to mock responses from the Backend. For example the case for reset password, I need to mock the token because otherwise it would be something random I couldn't implement some steps without knowing its value.

Aurélien Reeves
2022-01-05 02:33:36

*Thread Reply:* I think I would implement a fake backend myself as this is fairly simple to build a http server using node-js.

Do you need to also spy the fake server? Or mocking it would be fine?

Manuela Mag
2022-01-05 02:39:18

*Thread Reply:* just mocking would be fine

Manuela Mag
2022-01-05 02:59:00

*Thread Reply:* Thank you for your reply!

Manuela Mag
2022-01-05 03:28:42

*Thread Reply:* if you're using nodejs for mocking the server do you need to run the server separatly ? Or can i mock the server in the in steps already implemented and run everything with only one command for the cucumber tests?

Aurélien Reeves
2022-01-05 04:57:17

*Thread Reply:* You can basically do whatever you want actually

How do you execute your tests? Do you use npm scripts?

Manuela Mag
2022-01-05 04:58:35

*Thread Reply:* I'm running them using this command : "node ./node_modules/selenium-cucumber-js/index.js -s ./step-definitions"

Aurélien Reeves
2022-01-05 06:26:43

*Thread Reply:* I would recommend using npm scripts. To do so, in your package.json, add the following script:

"scripts": { "test": "npm run test:cucumber", "test:cucumber": "node ./node_modules/selenium-cucumber-js/index.js -s ./step-definitions" } Then to execute your tests, you would just have to run the following command: npm test.

Regarding your server, I would to managing it using hooks

You could start it using the beforeAll hook, and make sure to stop it in an afterAll hook.

You could also manage it using tags: you could have a tag which indicate that a scenario requires the server, then using Before and After hooks to start and stop the server per scenario depending their tags

Marcos Aruj
2022-01-05 21:16:46

@Marcos Aruj has joined the channel

Manuela Mag
2022-01-06 02:35:56

Hi! I'm facing a problem with the chromedriver and I was wondering if you could help me. I deleted the node_modules due to a previous error. But after installing the chromedriver and everything again I have this error This version of ChromeDriver only supports Chrome version 86 Current browser version is 97 I've checked the version of the chromedriver with chromeDriver -v and it's 97, I also replaced everything in the package.json and package-lock.json to be 97 version. The error still shows. The commands that I used are: npm install selenium-cucumber-js --save-dev and npm install chromedriver --chromedriver_version=LATEST

Aurélien Reeves
2022-01-06 02:42:04

*Thread Reply:* You may have another instance of Chrome driver installed

What is the result of which chromedriver ?

Manuela Mag
2022-01-06 04:27:26

*Thread Reply:* chromedrive not found

Manuela Mag
2022-01-06 04:27:44

*Thread Reply:* Should it be installed in another way or with another command then?

Manuela Mag
2022-01-06 04:37:30

*Thread Reply:* I've also tried to install chromedriver97 version and move it to usr/local/bin but it still says chromedrive not found

Aurélien Reeves
2022-01-06 05:03:09

*Thread Reply:* Did you miss the final r or is it copy/paste issue?

Aurélien Reeves
2022-01-06 05:04:04

*Thread Reply:* chromedriver -v still displays the wrong version number?

Make sure to also use the proper case for chromedriver. Don't know if it is chromeDriver or chromedriver

Manuela Mag
2022-01-06 05:04:30

*Thread Reply:* i missed the r, the return is : /Users/manuelamag/.nvm/versions/node/v16.7.0/bin/chromedriver

Aurélien Reeves
2022-01-06 06:11:30

*Thread Reply:* It seems you previously installed it globally (using npm i -g)

Try updating that one, or removing it to make sure using the local one

Manuela Mag
2022-01-06 06:14:26

*Thread Reply:* after npm uninstall chromedriver it should use the local one? I tried but I got the same error

Aurélien Reeves
2022-01-06 06:21:24

*Thread Reply:* no. Actually, npm uninstall chromedriver may have uninstalled the local one

Try to: • npm uninstall -g chromecriver to uninstall your global chromedriver • npm uninstall chromedriver to uninstall the local chromedriver if it is still there • rm -rf node_modules to remove the node modules folder • rm -f package-lock.json to remove the npm lock file • npm install to reinstall all the packages • npm install --save-dev chromedriver to reinstall chromedriver for your project Disclaimer: uninstalling chromedriver globally may break other projects on your computer. If you want to keep the global one, make sure to update it npm update -g chromedriver but do not uninstall it. Using global packages is discouraged, but if you have some dependencies on it, you may keep it

Manuela Mag
2022-01-06 06:24:24

*Thread Reply:* I tried the steps, but still shows the same error. I've removed the global driver

Aurélien Reeves
2022-01-06 06:41:46

*Thread Reply:* Could you paste the "devDependencies" section of your package.json? What is the result of which chromedriver ? chromedriver -v ? npx chromedriver -v? Which error do you have? The following one? This version of ChromeDriver only supports Chrome version 86 Current browser version is 97

Aurélien Reeves
2022-01-06 06:47:45

*Thread Reply:* It seems that selenium-cucumber-jsactually depends on chromedriver v86: https://github.com/john-doherty/selenium-cucumber-js/blob/master/package.json#L43 If you want to still use that package, you may have to use chrome 86. It seems selenium-cucumber-jsis not that maintained: https://github.com/john-doherty/selenium-cucumber-js/commits/master You may consider to avoid using it and do the automation by yourself 😓

Manuela Mag
2022-01-06 10:18:56

*Thread Reply:* I see the problem now, thanks! Could you perhaps tell me what would be a better package or maybe an easier to follow example ? I'm new with cucumber-js.

Aurélien Reeves
2022-01-06 12:06:17

*Thread Reply:* Well, maybe puppeteer with puppeteer-cucumber-js? https://github.com/john-doherty/selenium-cucumber-js

Stars
111
Language
JavaScript
Manuela Mag
2022-01-06 12:12:50

*Thread Reply:* Thank you, i will look at that

Manuela Mag
2022-01-06 14:10:28

*Thread Reply:* I have another question, I see that puppeteer works with chromium, I search online but I did not find anything about the difference between chrome and chromium when it comes to testing. Do you know if there is a big difference between them?

Aurélien Reeves
2022-01-06 22:22:39

*Thread Reply:* No difference between them for testing, don't worry 🙂

Manuela Mag
2022-01-07 00:01:40

*Thread Reply:* Good, thanks! 🙂

Aurélien Reeves
2022-01-07 00:27:22

*Thread Reply:* You are welcome 🙂

Good luck with your project!

Manuela Mag
2022-01-07 00:27:41

*Thread Reply:* Thank youu!

loveQE
2022-01-09 18:59:14

@loveQE has joined the channel

Matt Blickem
2022-01-10 00:44:25

@Matt Blickem has joined the channel

Niklas Lilland
2022-01-12 13:51:06

@Niklas Lilland has joined the channel

Rob Myers
2022-01-13 11:05:56

@Rob Myers has joined the channel

Akshu
2022-01-13 22:11:38

Are there any scenarios that integrated cucumber js with service now to create problem records?

matt-SmartBear
2022-01-14 11:29:47

*Thread Reply:* There's certainly nothing built into Cucumber, but it's pretty straightforward to use a REST API. It looks like ServiceNow has one:

https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/

developer.servicenow.com
matt-SmartBear
2022-01-14 11:30:45

*Thread Reply:* SuperAgent is a nice library for making REST calls: https://www.npmjs.com/package/superagent

npm
matt-SmartBear
2022-01-14 11:31:15

*Thread Reply:* Or you can use node-fetch: https://www.npmjs.com/package/node-fetch

npm
Akshu
2022-01-18 07:38:11

*Thread Reply:* Ohh!! Thanks a lottt

Akshu
2022-01-18 07:38:15

*Thread Reply:* I can try that

matt-SmartBear
2022-01-14 16:37:41

After @Josh Houlker asked for a typescript example the other day, I created a new repo of cucumber-js examples, here. It's a bit empty at the moment!

What are some other common setups you'd like to see examples for? A React app, for example, or Angular-JS? Using frameworks like Selenium, Cypress or Puppeteer? Please let me know!

Last updated
25 minutes ago
Josh Houlker (https://cucumberbdd.slack.com/team/U02U6K8JY48)
🥳 Rob Myers, Joe A, Akshu
👍 Matt Blickem
Rob Myers
2022-01-15 13:56:40

*Thread Reply:* I get clients using React, Angular, Promises. I’ve managed to grok Promises enough to build a Jasmine example, long ago. But I don’t know enough about React or Angular to sling code with any authority. So, in brief: ALL OF THE ABOVE! 😂

👍:skin_tone_2: matt-SmartBear
Matt Blickem
2022-01-17 00:51:45

*Thread Reply:* very nice. if I find the time I would like to add a 'fullstack' example with node backend and react frontend tested together in cucumber

👍:skin_tone_2: matt-SmartBear
➕ Rob Myers
Matt Blickem
2022-01-17 00:53:12

*Thread Reply:* it would also be very helpful to have examples of mocking and assertions with libraries like chai or jest

👍:skin_tone_2: matt-SmartBear
Joe A
2022-01-17 09:45:47

*Thread Reply:* I’d really love to see examples of customizing the formatter. Something I’ve wanted to play around with in the past but don’t even know where to start

👍:skin_tone_2: matt-SmartBear
Matt Blickem
2022-01-28 08:24:32

*Thread Reply:* hey @matt-SmartBear how do I contribute an example?

matt-SmartBear
2022-01-28 10:38:32

*Thread Reply:* 👋:skintone2: hi Matt.

Good question, we should probably document that!

I'm hoping you can clone the https://github.com/cucumber-examples/cucumber-js-examples repo, add a new folder in examples with your example, link to it from the README, then send us a pull request.

Does that make sense?

Language
Makefile
Last updated
14 days ago
Matt Blickem
2022-01-31 00:56:13

*Thread Reply:* makes perfect sense! but I had a permission denied error when I tried to push my branch ... what am I doing wrong? it should be from a fork?

Matt Blickem
2022-01-31 08:09:30

*Thread Reply:* here is the example I've committed to a separate repo for now 😉 https://github.com/explosivose/cucumber-example-ts-node-react

Language
TypeScript
Last updated
a minute ago
matt-SmartBear
2022-01-31 10:37:35

*Thread Reply:* Hi Matt, that's great thankyou!

matt-SmartBear
2022-01-31 10:37:49

*Thread Reply:* Did you push to a fork of the repo, or had you just cloned the one in the cucumber-examples org?

matt-SmartBear
2022-01-31 10:38:35

*Thread Reply:* If you try to push to the one in the cucumber-examples org, you'll get a permission denied as you're not a member of that org (yet)

matt-SmartBear
2022-01-31 10:39:12

*Thread Reply:* That should let you push (to your fork) then you can make a pull request from there.

matt-SmartBear
2022-01-31 10:39:26

*Thread Reply:* Let me know if that doesn't make sense! Sorry there's not a contributor guide yet!

Matt Blickem
2022-02-01 04:43:17

*Thread Reply:* thanks Matt I'll try it out a little later

Mui
2022-01-18 00:45:17

@Mui has joined the channel

Rajeshwar Sharma
2022-01-18 05:30:01

@Rajeshwar Sharma has joined the channel

Milad
2022-01-19 05:15:25

@Milad has joined the channel

Milad
2022-01-19 05:30:58

Dear CucumberJs people, at our company we are trying to setup a new test-system for our existing app using the setup CucumberJs, Typescript and Playwright. For our tests we would like to have access to the code of our own app (Angular + Typescript), for example to use some helper classes to do api calls.

Now, I have a hard time to import our app code in the tests. The problem is that we have some complited circular dependencies in our app code. For our app we use tsconfig.json -> module: es2020 with which we can manage the circular dependencies well. We use a index.ts file where we define the "correct" order to import the files. But, unfortunately CucumberJs does not support Typescript + es2020 Module, but needs us to use CommonJS (https://github.com/cucumber/cucumber-js/blob/main/docs/esm.md). But, I have a really hard time getting our circular dependencies to work using CommonJS as the CommonJs way of importing files is different.

I would appreciate any suggestion as I am stuck with this problem. Is there a chance that CucumberJs supports es2020 + Typescript in near future?

Aurélien Reeves
2022-01-19 08:08:14

*Thread Reply:* Do you think it would be possible to share a public repo with a minimal reproducible example?

Michael Morris
2022-01-20 18:28:39

*Thread Reply:* Take a look at screenplay. https://github.com/cucumber/screenplay.js/

Michael Morris
2022-01-20 18:29:18

*Thread Reply:* I ran across it while looking at Playwright as a possible upgrade from Puppeteer which is what I'm currently using. I haven't had a chance to look at it in depth but it looks promising.

Milad
2022-01-21 02:23:43

*Thread Reply:* Thank you for your responses. I decided to give up the attemp to integrate our app code into the cucumber tests because I encountared also other problems.

My original idea was to perhaps also write our unit/integration tests with cucumber where I would need direct access to the app code. Is this something you would recommend or would you say generally cucumber should be used only for end-to-end tests?

Michael Morris
2022-01-21 05:19:50

*Thread Reply:* I use Cucumber to test the javascript layer of a web application without working with it's actual API, which is quite complex. Using a concoction of Node, Express and Faker I generate test data, and I use Puppeteer's request interrupt feature to redirect API calls to this mock server.

That's why screenplay intrigues me if I understand it's readme correctly. It has the ability to abstract away this mocking from the main test so that it can run in both end2end and functional modes.

slackbot
2022-01-21 05:19:50

*Thread Reply:* ** https://cucumber.io/blog/the-worlds-most-misunderstood-collaboration-tool

Cucumber.io
Milad
2022-01-21 09:12:08

*Thread Reply:* Not sure if you posted this link here or it was a bot, but found that article really good to better understand the intention of cucumber: https://cucumber.io/blog/the-worlds-most-misunderstood-collaboration-tool

Cucumber.io
Aaron Bruce
2022-01-19 19:47:53

@Aaron Bruce has joined the channel

Manuela Mag
2022-01-21 03:10:30

Hello, I have a problem and I was wondering if you could help me. I running 2 different scenarios: one for successfully sending an email to the user and one to go back to a previous page. If I run them separately they pass, but if I'm running them together the second one fails saying in the first step that it cannot find the element (a modal that says the email was sent successfully) from the previous scenario's last step. I tried to add a setTimeout to the last step from the first scenario, but I still get the same error. Same thing happens if a scenario fails, the next one's first step will fail as well

Michael Morris
2022-01-21 05:21:56

*Thread Reply:* async/await is your friend if you aren't already using it

Michael Morris
2022-01-21 05:22:19

*Thread Reply:* If you are I'll need more details to be of use.

Manuela Mag
2022-01-21 05:30:58

*Thread Reply:* The first scenario

``` Given('I land on Forgot password Page', async function () { await driver.get("https://dev.io/forgot-password"); }); When('I click on Submit', async function () {     var submitButton = By.css('body > app-root > app-forgot-password > div > div > div > div:nth-child(2) > div.login.center > form > div:nth-child(2) > div > app-button > div > div > button');     var forgotEmail = By.css('body > app-root > app-forgot-password > div > div > div > div:nth-child(2) > div.login.center > form > div.form-group.mt-3.col-8.input-position > app-input > div > div > input');

    await driver.findElement(forgotEmail).sendKeys("email");     await driver.wait(until.elementsLocated(submitButton), 10000);     await driver.findElement(submitButton).click(); }); Then('I see the Success message', async function () { var error = By.css("#myModal > div > div > div > div.flex-item-content > div.modal-body"); var value = "An email has been sent to you with a link to reset your password."; await driver.wait(until.elementLocated(error, 10000)); driver.findElement(error) .then(function() { driver.findElement(error).getText() .then(function (state) { value = state; expect(value).to.equal(state); } ); });

    // setTimeout(function() {
    // }, 3000);

}); Second scenario: Given('I land on Forgot password Page', async function () { await driver.get("https://dev.io/forgot-password"); }); When('I click Back to login', async function () { var backButton = By.css("body > app-root > app-forgot-password > div > div > div > div:nth-child(2) > div.login.center > form > p"); await driver.wait(until.elementLocated(backButton, 10000)); driver.findElement(backButton) .then(function() { driver.findElement(backButton).click(); } ); await driver.getCurrentUrl() .then( function(currentUrl){ expect("https://dev.io/login").to.equal(currentUrl); }); }); Then('I am directed to the Login Page', async function () { var backToLoginButton = By.css("body > app-root > app-forgot-password > div > div > div > div:nth-child(2) > div.login.center > form > p"); await driver.wait(until.elementsLocated(backToLoginButton), 10000); await driver.findElement(backToLoginButton).click(); });```

Manuela Mag
2022-01-21 05:33:35

*Thread Reply:* This are the implementations for the scenarios

Mona Ghassemi
2022-01-21 06:22:02

*Thread Reply:* I recommend trying to simplify your selectors a bit. You should be able to remove some ">" and find descendants (with just a space) instead of direct descendants (here's a random resource: https://www.freecodecamp.org/news/css-selectors-cheat-sheet/). This will make your code cleaner.

It sounds like you are possibly running into some state issues. You could try: https://webdriver.io/docs/api/browser/reloadSession/ (if using webdriverIO)

Finally, this is not really a cucumber question, more of selenium/browser question, and you may find better support elsewhere (webdriverIO has a gitter chat, for example).

freeCodeCamp.org
Written by
<a href="http://freeCodeCamp.org">freeCodeCamp.org</a>
Filed under
CSS
webdriver.io
Manuela Mag
2022-01-21 06:37:09

*Thread Reply:* Thank you!

👍 Mona Ghassemi
Sayor Basu
2022-01-28 16:27:22

@Sayor Basu has joined the channel

plocket
2022-01-29 19:05:09

I think I’ve misunderstood something about npm, but maybe it has to do with cucumber. I did npm install --save @cucumber/cucumber and the package.json shows a pre release version: "@cucumber/cucumber": "^8.0.0-rc.2". Does anyone know if I’ve done something wrong?

plocket
2022-01-29 19:07:27

When I edit to ^8.0.0 and run npm install I get “No matching version found for @cucumber/cucumber@^8.0.0”

Aaron Bruce
2022-01-29 20:56:17

They tagged their rc as "latest" either on purpose or otherwise. If you want an earlier version you'll need to specify one of the 7. packages

plocket
2022-01-30 05:32:43

*Thread Reply:* Is there someone here who would know?

matt-SmartBear
2022-01-30 21:33:57

*Thread Reply:* @David Goss

David Goss
2022-01-31 05:58:03

*Thread Reply:* I don't think you “tag as latest” in npm do you? That's a docker thing AFAIK

David Goss
2022-01-31 05:59:30

*Thread Reply:* It's unfortunate that when you install without specifying a version you get the RC. It'd be better if you got the latest stable instead.

David Goss
2022-01-31 06:00:45

*Thread Reply:* Oh I was wrong https://docs.npmjs.com/cli/v8/commands/npm-publish

docs.npmjs.com
David Goss
2022-01-31 06:01:14

*Thread Reply:* > Sets tag 'latest' if no --tag specified

plocket
2022-01-31 06:01:14

*Thread Reply:* I’m not sure about npm and “latest”. I don’t publish a lot, sorry. I did think it was not supposed to pull in pre-releases.

plocket
2022-01-31 06:01:33

*Thread Reply:* Oh, wow. That seems unfortunate.

😬 David Goss
David Goss
2022-01-31 06:01:35

*Thread Reply:* We may need to tweak our release process a bit

plocket
2022-01-31 06:02:07

*Thread Reply:* That’s a good thing for me to know too.

Aaron Bruce
2022-01-31 06:27:51

*Thread Reply:* This default behavior has gotten me in the past as a publisher so I assumed it wasn't on purpose, but didn't want to jump to conclusions in a public forum! Thanks for weighing in David

👍 David Goss
👍:skin_tone_2: matt-SmartBear
David Goss
2022-01-31 08:10:38

*Thread Reply:* in the meantime i guess publishing a new patch version from the 7.x branch would make that latest and mitigate in the short term

matt-SmartBear
2022-01-31 10:36:49

*Thread Reply:* Could we use npm-dist-tag to tidy up? https://docs.npmjs.com/cli/v8/commands/npm-dist-tag

docs.npmjs.com
David Goss
2022-01-31 10:59:10

*Thread Reply:* Good call Matt, will do

David Goss
2022-01-31 11:17:33

*Thread Reply:* Okay that’s done, so now our tags are: latest: 7.3.2 next: 8.0.0-rc.2 (Given the convention of tagging betas and rcs as next in JS land)

David Goss
2022-01-31 11:17:54

*Thread Reply:* @matt-SmartBear watch out for a PR that updates our npm release action

David Goss
2022-01-31 11:53:19

*Thread Reply:* https://github.com/cucumber/action-publish-npm/pull/1

Comments
1
matt-SmartBear
2022-01-31 13:34:50

*Thread Reply:* Nice one @David Goss! I've released v1.1.0 of the action-publish-npm GitHub action with this new input in it. How will we use it?

David Goss
2022-01-31 13:43:21

*Thread Reply:* just working that up in cucumber-js now, hold my beer

matt-SmartBear
2022-01-31 13:48:37

*Thread Reply:* 🍺

David Goss
2022-01-31 14:00:49

*Thread Reply:* behold https://github.com/cucumber/cucumber-js/pull/1905

Labels
🔧 build
Comments
1
🙌 plocket
matt-SmartBear
2022-01-31 14:43:36

*Thread Reply:* Perfect. Merged!

plocket
2022-01-30 05:35:42

~I’m moving from 6.x.x to the latest version and I’m getting the error TypeError: Cannot set properties of undefined (setting 'World') cucumberjs. I didn’t see anything about this in migration or in the issues. Does someone know what might be going on?~ world.js is the one place I’m requiring cucumber, duh. Sorry about that.

matt-SmartBear
2022-01-30 21:33:36

*Thread Reply:* if you're going from 6.x it might be smoother to go to 7.x first, then go from 7-8, especially since 8 is only a release candidate at the moment and may not be totally stable.

✅ plocket
plocket
2022-01-30 05:49:43

Sorry, this is my first time doing any kind of major migration, strangely enough.

plocket
2022-01-30 06:11:24

I do need to set the default timeout dynamically from within a step so that it’ll affect all future steps, but I’m reading the timeout docs and they now say you can’t do it with setDefaultTimeout. Is there any way to do it other than disabling the cucumber timeout and handling it manually in each individual step?

plocket
2022-01-31 06:06:27

*Thread Reply:* Right now I’m trying to kind of hack it with { timeout: -1 } and wrapPromiseWithTimeout. A bit new to promises. Does someone know if I have to return for it to work? Not sure if I’m doing something else wrong.

plocket
2022-01-30 06:11:55

Does anyone know why that changed?

plocket
2022-01-30 06:22:33

I’m making a PR to update the [docs]. Do I need to update CHANGELOG.md? I don’t see other entries for pure documentation edits in the CHANGELOG.

matt-SmartBear
2022-01-30 21:32:43

*Thread Reply:* no, that's fine

matt-SmartBear
2022-01-30 21:32:53

*Thread Reply:* thanks for help with the docs!

plocket
2022-01-31 06:04:55

*Thread Reply:* Thank you for this awesome library!

plocket
2022-01-31 06:06:57

*Thread Reply:* Also, sorry that I’m misusing it so badly. It’s [for a good cause, but still]

David Goss
2022-01-31 05:57:08

@David Goss has joined the channel

plocket
2022-01-31 06:59:40

Now that I’m using v7, I’m getting that wrapPromiseWithTimeout is undefined . v7.3.2. Sorry to be a pain, but I thought wrapPromiseWithTimeout was a v7 thing (latest stable version), right?

plocket
2022-01-31 07:41:22

*Thread Reply:* If it’s not functioning, can we still use the global setDefaultTimeout()? I can experiment, I’m just hoping not to run into any gotcha’s later.

Either way, maybe the instructions for using it should be removed from the docs completely until it’s ready.

David Goss
2022-01-31 08:07:57

*Thread Reply:* looking at the changelog, wrapPromiseWithTimeout is from 8.0.0-rc1 - are you able to use that version? https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md

plocket
2022-01-31 10:24:33

*Thread Reply:* Hmm, I’m a little confused on a couple levels here, so I’ll try to articulate.

First, for my package: Since 8.0.0-rc.1 isn’t stable, I’m hesitant to use it for my package. Remembering to update it in the future may be complicated and easy to lose track of as well (esp. since I’m not convinced npm will update properly to the latest stable future version).

For others: Are the docs supposed to be for a non-stable version? Because right now the instructions for customizing a timeout has wrapPromiseWithTimeout.

For the migration docs: I may need to correct my update to the migration docs because they might be wrong at the moment. The v7 migration now says you can’t use setDefaultTimeout in a non-global context. That might not be true for v7. I’m not sure anymore.

plocket
2022-01-31 11:00:31

*Thread Reply:* Is v8.0.0-rc.1 stable enough to count on for this stuff?

David Goss
2022-01-31 12:04:02

*Thread Reply:* that’s fair, i think it’s best to stay on stable for the reasons you say. in the meantime you could just grab the source of that function for now if its helpful https://github.com/cucumber/cucumber-js/blob/main/src/time.ts#L42

✅ plocket
David Goss
2022-01-31 12:05:07

*Thread Reply:* with the docs, yeah the docs in main can include stuff that isn’t released yet. https://github.com/cucumber/cucumber-js/tree/7.x is the right set for the current stable. this is definitely not ideal, we’ll review how to avoid it in future

✅ plocket
plocket
2022-01-31 14:56:52

*Thread Reply:* Our project is also struggling with how to handle multiple stable releases. We still haven’t figured out how to handle the docs for those. Badly, mostly.

plocket
2022-01-31 14:58:00

*Thread Reply:* We’re thinking of removing the docs from the main branch and just referring to the ones in the specific version branches. At least, anything other than an overview.

plocket
2022-02-01 07:25:43

I’m seeing change with v7 that I don’t see in the changelog and I just want a reality check. This is going to sound weird.

In v6, when a step failed and our code changed the scenario status to “passed”, the final output would show all scenarios passed, but one step failed. Now it shows all scenarios passed and all steps passed. Is that expected behavior for v7?

[The “F” does still appear in the progress indicator as before.]

matt-SmartBear
2022-02-01 15:15:52

*Thread Reply:* that does sound weird! May I ask why you're doing that?

plocket
2022-02-01 18:18:36

*Thread Reply:* You certainly may! We’re misusing cucumber to write a testing framework for an open source platform that helps people create legal forms. Our team in particular is working on emergency legal forms (restraining orders, eviction stays, etc.), but we’re hoping to help the other users of the platform as well, most of who are pro bono legal services [and don’t have a lot of money or resources].

Most of these developers are actually not coders, [they’re lawyers]. We output reports to developers who run the tests to give them information that are easier for them to understand and have more relevant details. We want to be able to test the reports we output for them, even/especially when they’re describing errors. [That is, failing tests.]

I’m not sure that was a very clear explanation, so let me know if you have more questions.

matt-SmartBear
2022-02-01 22:16:34

*Thread Reply:* I'm intrigued, but still puzzled! Can you give me a real-world example?

plocket
2022-02-02 06:36:56

*Thread Reply:* Very abstract example Scenario our users can write:

Scenario: I get a document Given I start the interview at "important_form.yml" When I tap to continue And I set "user.name.first" to "Maria" And I set "user.name.last" to "Gonzalez" And I tap to continue Then I download "landlord-notice.pdf" There’s a more “story-driven” step, but it’d be harder to explain.

So, for our error catching, if puppeteer “tapped to continue” and hit an error screen, we’d print the text on the error screen in the report we make. We want to be able to test that our code adds the error text at appropriate times.

Is that the info you were looking for? Also, if you want a real-world example, I can point you to one, but it would be a lot to put here.

plocket
2022-02-05 08:17:40

*Thread Reply:* So is the new step reporting behavior intentional?

nean-0
2022-02-06 15:50:03

@nean-0 has joined the channel

Manuela Mag
2022-02-07 02:25:47

Hello, I have a question. Can you check the pattern of a text you get with driver.findElement().getText()? I'm trying to check if the date format is respected(ex : January 28, 2022). Can there be used in some way a regex and the text to be split or is there another easier way?

Aslak Hellesøy
2022-02-07 09:21:04

*Thread Reply:* @Manuela Mag that sounds like a question about Selenium WebDriver. In general it's better to use their forum for questions about that.

Lowen
2022-02-07 02:56:11

@Lowen has joined the channel

matt-SmartBear
2022-02-07 13:28:50

@Manuela Mag what assertion library are you using? You can use https://www.geeksforgeeks.org/node-js-assert-match-function/ to assert that a string matches a regex pattern. Or hamjest's matchesPattern https://github.com/rluba/hamjest/wiki/Matcher-documentation#matchespatternstringorregexp

GeeksforGeeks
Manuela Mag
2022-02-08 04:34:30

*Thread Reply:* Thank youu!

Sindhu Lingaraju
2022-02-08 01:54:54

@Sindhu Lingaraju has joined the channel

anthony dev
2022-02-08 13:17:37

@anthony dev has joined the channel

Ikenna Okafor
2022-02-09 06:47:56

@Ikenna Okafor has joined the channel

santiago rios olaya
2022-02-09 15:55:49

@santiago rios olaya has joined the channel

binarymist
2022-02-10 02:00:40

Hi. Am I correct that ESM support was added and then removed again (https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md#fixed-5)?

Aurélien Reeves
2022-02-10 02:03:33

No, ESM has been added in 8.0.0-rc.1 and is still there at the moment

binarymist
2022-02-10 02:04:01

I'm on "@cucumber/cucumber": "^7.3.2", and having an issue with calling run on a new instance of cucumber.Cli

binarymist
2022-02-10 02:04:26

Error [ERRREQUIREESM]: require() of ES Module /usr/src/app/src/steps/steps.js from /usr/src/app/nodemodules/@cucumber/cucumber/lib/cli/index.js not supported. Instead change the require of steps.js in /usr/src/app/nodemodules/@cucumber/cucumber/lib/cli/index.js to a dynamic import() which is available in all CommonJS modules.

binarymist
2022-02-10 02:05:21

So solution is to use 8.0.0-rc.2?

Aurélien Reeves
2022-02-10 02:07:36

Yes

binarymist
2022-02-10 02:08:35

Thanks @Aurélien Reeves

Aurélien Reeves
2022-02-10 02:09:17

You're welcome 🙂

binarymist
2022-02-10 02:29:59

import cucumber from '@cucumber/cucumber'; ^^^^^^^^ SyntaxError: The requested module '@cucumber/cucumber' does not provide an export named 'default'

binarymist
2022-02-10 02:30:07

Hmm, no default export?

Aurélien Reeves
2022-02-10 02:35:57

More context would be helpful actually

binarymist
2022-02-10 02:37:30

This now breaks: import cucumber from '@cucumber/cucumber';

Aurélien Reeves
2022-02-10 02:38:09

What are you trying to import actually? Indeed cucumber has no default export ... on purpose

binarymist
2022-02-10 02:38:10

Where as it seems to be fine in 7.3.2

binarymist
2022-02-10 02:38:29

Ok, so it's a breaking change that's not listed?

Aurélien Reeves
2022-02-10 02:38:34

what are you trying to achieve?

binarymist
2022-02-10 02:38:42

import cucumber

Aurélien Reeves
2022-02-10 02:39:07

what for? There is no such thing as "importing cucumber".

binarymist
2022-02-10 02:39:31

Hmm, it's worked for months like that

binarymist
2022-02-10 02:39:42

Now that I'm upgrading it no longer does

Aurélien Reeves
2022-02-10 02:40:08

Do you have more context? More example? More code? What did work previously?

Aurélien Reeves
2022-02-10 02:40:14

How did you used cucumber?

binarymist
2022-02-10 02:43:20

On version 7.2.1 we could pull in cucumber with: const cucumber = require('@cucumber/cucumber'); . I upgraded to 7.3.2 and used import cucumber from '@cucumber/cucumber'; and it worked fine. Now I upgrade to 8.0.0-rc-2 (as you mentioned that's what we need for ESM) and cucumber can no longer be imported.

binarymist
2022-02-10 02:46:47

As an aside, we're using new cucumber.Cli to create a Cli instance

binarymist
2022-02-10 02:46:56

and always have been

Aurélien Reeves
2022-02-10 02:49:24

Cucumber has not been disigned to be used as a global object.

You need to import what you actually need.

If you need the CLI, something like import { Cli } from '@cucumber/cucumber' should work well.

binarymist
2022-02-10 02:51:52

OK, (We've been using it like this for 4 years) so it's a breaking change, it's just not documented by the looks of it

binarymist
2022-02-10 02:53:03

https://github.com/purpleteam-labs/purpleteam-app-scanner/blob/main/src/api/app/models/app.js#L11

Aurélien Reeves
2022-02-10 02:53:37

That was cjs code, not esm.

binarymist
2022-02-10 02:54:10

That's right, we're forced to upgrade to ESM

binarymist
2022-02-10 02:54:40

So there's no way to get cucumber

Aurélien Reeves
2022-02-10 02:55:27

And the thing is that ESM are not working exactly the same as CJS modules. At least at the moment, there is no way to get a global cucumber object.

binarymist
2022-02-10 02:56:05

Ok, NP, so long as we know what to do 😉

binarymist
2022-02-10 03:03:16

and thanks @Aurélien Reeves, it's maintainers like you that really make these problems a lot more bearable.

❤️ matt-SmartBear
Aurélien Reeves
2022-02-10 03:04:28

You are very welcome 🙂

Something else: there is no global cucumber object. But if you had access previously to some API, you sould still be able to access it now. If it is not the case, let us know, that may be an issue

binarymist
2022-02-10 03:05:07

API as in CLI for example?

Aurélien Reeves
2022-02-10 03:05:55

Yeah, for example

binarymist
2022-02-10 03:06:15

Where are the other API's listed?

Aurélien Reeves
2022-02-10 05:13:47

*Thread Reply:* There is actually no documented list of the APIs.

I just meant that if you previously had used something from Cucumber that seems not available anymore because it is not explicitely exported, let us know

binarymist
2022-02-10 03:08:58

import { Cli as CucCli } from '@cucumber/cucumber'; ^^^ SyntaxError: Named export 'Cli' not found. The requested module '@cucumber/cucumber' is a CommonJS module, which may not support all module.exports as named exports.

binarymist
2022-02-10 03:16:54

I think that might be a false alarm, I failed to save a package.json after bumping version... Sorry

👌 Aurélien Reeves
anthony dev
2022-02-10 07:22:42

Good morning,

We are starting to look into using cucumber have a couple of questions will split them up.

1- What linter is recommended since we want to make sure all of the features/steps follows a standard

David Goss
2022-02-10 11:44:22

*Thread Reply:* I don’t think we have an official answer, but personally I’ve used and contributed to these: • https://github.com/vsiakka/gherkin-lint for linting feature files e.g. how many steps in a scenario, scenarios in a feature, correct use of And/But etc • https://github.com/darrinholst/eslint-plugin-cucumber for linting your JS step code e.g. no arrow functions, prefer one type of expression, etc

Stars
117
Language
JavaScript
Stars
3
Language
JavaScript
anthony dev
2022-02-10 11:48:02

*Thread Reply:* Thank you

anthony dev
2022-02-10 08:25:58

Question 2 - We are trying to figure out how to create a POM object to pass in the driver. We are facing an issue with our POM object that needs to be created in each step (require a driver in a constructor), but we want it to initialize once if possible. Moving the creation of the POM out of each step this.driver is null.

What we are trying to do is it possible with the framework?

Below you can see that each step creates a new POM object.

```//SearchPagePom.js const { By } = require('selenium-webdriver');

/* * Locators */ const searchBox = By.xpath('//[@data-a8n="quick-search-input"]'); const searchSubmitBtn = By.xpath('//*[@data-a8n="quick-search-submit"]');

class SearchPage { constructor(driver) { this.driver = driver; }

inputSearchQuery(searchQuery) {
    return this.driver.findElement(searchBox).sendKeys(searchQuery);
}

clickSearchBtn() {
    return this.driver.findElement(searchSubmitBtn).click();
}

}

module.exports = SearchPage; //SearchPageTest.js const assert = require('cucumber-assert'); const SearchPage = require('../../page-objects/searchPage');

module.exports = function () {

//would like to createSearch Page once here but driver is null here this.When(/^I search for "([^"]**)"$/, function (searchQuery, next) { const searchPage = new SearchPage(this.driver);

    searchPage.inputSearchQuery(searchQuery);
    searchPage.clickSearchBtn();
    next();
});

this.Then(/^I should see search result heading as "([^"]**)"$/, function (searchHeading, next) {
    const searchPage = new SearchPage(this.driver);
    searchPage.getSearchKeyword().then(function (heading) {
        assert.equal(heading, "\"" + searchHeading + "\"", next, 'Expected search heading to be ' + searchHeading);
    });

};```

David Goss
2022-02-10 11:50:53

*Thread Reply:* You might try setting the driver on your World via a Before hook so that it’s available to each step at the start and you get a new one for each scenario that’s run https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md

anthony dev
2022-02-10 11:52:52

*Thread Reply:* so to my understanding then I would add the POM to the world object and expose it as property?

David Goss
2022-02-10 12:01:10

*Thread Reply:* Yep you could do it that way

anthony dev
2022-02-10 12:11:31

*Thread Reply:* The only concern I have we going to have many POM objects that are exposed and going to be shared across 5 to 10 repos. So the world object may get big and messy quickly. I was hoping to get the POM initialize with the steps file is that still possible using the world object

David Goss
2022-02-10 12:24:17

*Thread Reply:* Yeah so you could have the driver live in the world but then initialise your page object in the step definition using the driver you grab from the world (this) - does that make sense?

anthony dev
2022-02-10 12:42:11

*Thread Reply:* somewhat it does that mean i need to do it on each When or Then or just once at the step def?

David Goss
2022-02-10 12:44:24

*Thread Reply:* Within each When or Then function

anthony dev
2022-02-10 12:45:15

*Thread Reply:* I was hoping once since not sure how many then and when will exists in each file

matt-SmartBear
2022-02-10 11:00:10

@binarymist if you have a suggestion for how we could better document the changes in the release notes for v8, that would be super helpful! It's sometimes hard for us to really get into our users' shoes and explain things from their perspetive.

Kim (https://cucumberbdd.slack.com/team/U9PB97RGT)
David Goss
2022-02-10 11:42:39

*Thread Reply:* I’m tempted to disagree on this being a breaking change because it was never documented you could do it and arguably a quirk of CommonJS. But probably useful to call out since we know about it. Perhaps worth starting a new “ESM” heading here with a note about this https://github.com/cucumber/cucumber-js/blob/main/docs/migration.md - would you consider doing a PR for that @binarymist?

👍 Aurélien Reeves
binarymist
2022-02-10 14:47:20

*Thread Reply:* Yip, happy to sub PR. I'll get everything working first along with some testing. How far away is 8.0.0?

binarymist
2022-02-10 15:53:36

*Thread Reply:* I don't see anything mentioned in docs about having to pass the env into instantiation of a Cli?

binarymist
2022-02-10 15:54:15

*Thread Reply:* This commit added the env into new Cli: https://github.com/cucumber/cucumber-js/commit/efff3a3516a6fd2f2a77de2f1dd6ac515349e8d6 @David Goss

binarymist
2022-02-10 15:56:28

*Thread Reply:* The CUCUMBER_PUBLISH_ENABLED doesn't appear to be new, but I don't see it mentioned in any doc other than issues, and now it seems it's required by the Cli

binarymist
2022-02-13 19:09:04

*Thread Reply:* It seems that getConfiguration has been remove from Cli somewhere between 7.2.1 and 8.0.0-rc.2. Is there some sort of replacement? Can you help with this @Aurélien Reeves?

binarymist
2022-02-13 19:16:48

*Thread Reply:* Hopefully you'll remember: https://github.com/purpleteam-labs/purpleteam-app-scanner_cucumber-1489-repro

Language
JavaScript
Last updated
8 months ago
binarymist
2022-02-13 19:24:49

*Thread Reply:* It looks like most of the methods have been removed from the Cli class. getConfiguration was removed in: https://github.com/cucumber/cucumber-js/commit/efff3a3516a6fd2f2a77de2f1dd6ac515349e8d6 and there doesn't appear to be a replacement @David Goss? Where should we find the same functionality?

Aurélien Reeves
2022-02-14 00:11:06

*Thread Reply:* A lot happened actually as part of the following PR: https://github.com/cucumber/cucumber-js/pull/1849

You may consider taking some time to review it properly. That should help you with integrating with cucumber 8.0+

Actually before then, there were no documented API to execute cucumber programmatically. This is the purpose of the work done as part of v8: having a proper, documented way to interact with cucumber programmatically.

A lot may have changed, but actually you should be able to find the same things than before, they may have just moved.

Comments
7
Milestone
<a href="https://github.com/cucumber/cucumber-js/milestone/13">JavaScript API</a>
Aurélien Reeves
2022-02-14 00:11:32

*Thread Reply:* @David Goss I guess we may consider documenting that new API for the final 8.0.0?

David Goss
2022-02-14 13:01:19

*Thread Reply:* Still WIP but yes will be documented in final

binarymist
2022-02-15 16:52:34

*Thread Reply:* It's interesting that "no breaking changes" is mentioned a number of times in the PR you mentioned @Aurélien Reeves. I guess that part got forgotten in all the excitment?

> A lot may have changed, but actually you should be able to find the same things than before, they may have just moved. It appears as though getConfiguration has been removed rather than "just moved", at least I can't find it in the PR you mentioned. The implementation also appears to be removed rather than "just moved"

I'm really hoping I'm wrong..?..

David Goss
2022-02-15 23:36:15

*Thread Reply:* Can you show an example of how you're using the Cli class? I'm not sure why you'd need to call getConfiguration directly

Aurélien Reeves
2022-02-16 00:05:59

*Thread Reply:* @binarymist actually what did change was not publicly documented APIs. From a public API point of view, the PR does actually add new things

When hacking on something using non-documented functionalities or internal APIs which are not mean to be used by third parties, you are subject to undocumented breaking changes. This is exactly what happens here.

binarymist
2022-02-16 00:11:29

*Thread Reply:* @David Goss As linked to above: https://github.com/purpleteam-labs/purpleteam-app-scanner/blob/main/src/api/app/models/app.js#L200 and the minimum repro example that @Aurélien Reeves helped with: https://github.com/purpleteam-labs/purpleteam-app-scanner_cucumber-1489-repro/blob/main/src/api/app/models/app.js

binarymist
2022-02-16 00:15:07

*Thread Reply:* OK @Aurélien Reeves, so now that the API has been removed, what should we use instead?

Aurélien Reeves
2022-02-16 01:17:43

*Thread Reply:* The new one issued from the PR#1849

If something is missing for you, you can take part of the discussion here: https://github.com/cucumber/cucumber-js/issues/1711 or in the PR

Assignees
@davidjgoss
Labels
⚡ enhancement
binarymist
2022-02-16 15:56:51

*Thread Reply:* The new one appears to be missing the functionality @Aurélien Reeves, does it not? Thanks for the link.

NewCoderCA
2022-02-10 15:08:06

@NewCoderCA has joined the channel

Andrei Fedulin
2022-02-13 23:12:02

@Andrei Fedulin has joined the channel

Sunil Kunda
2022-02-22 00:33:42

@Sunil Kunda has joined the channel

Sunil Kunda
2022-02-22 00:40:55

Hi Team, I have spring integration with cucumber, I have created multiple step definition class and all the classes extends ExporterComponentTests @CucumberContextConfiguration @SpringBootTest(classes = { TestConfiguration.class, ExporterComponentTests.TestConfiguration.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @ContextConfiguration() @AutoConfigureMockMvc @AutoConfigureWebTestClient(timeout = "30000") public class ExporterComponentTests It is working fine with cucumber-spring 6.3.0 version but failing with the latest version saying expected single matching bean but found 8 Can you please point me to a migration document or some example with the latest version? Thank you in advance.

David Goss
2022-02-22 01:24:09

*Thread Reply:* I think you're looking for <#C5YHPPJMP|help-cucumber-jvm> - you should be able to get some support in there

👍:skin_tone_2: Jo Laing
:gratitude_thank_you: Sunil Kunda
LayMui
2022-03-02 19:23:59

“test:address:stage”: “cross-env NODE_ENV=stage cucumber-js --tags=‘@address and not @pending’“,

LayMui
2022-03-02 19:24:28

*Thread Reply:* and not @pending does not work on windows

Aurélien Reeves
2022-03-03 01:34:04

*Thread Reply:* which version of cucumber are you using?

latest version may have some improvements regarding windows support

Also what "does not work" mean exactly? Do you have more info? Some error message maybe?

LayMui
2022-03-03 19:21:03

*Thread Reply:* i am using 7.3.2 for @cucumber/cucumber

LayMui
2022-03-03 19:21:27

*Thread Reply:*

Aurélien Reeves
2022-03-03 23:53:04

*Thread Reply:* Thanks.

Take a look at the following, there is a workaround for Windows: https://github.com/cucumber/cucumber-js/issues/1796#issuecomment-938405981

The issue is actually related to npm

Eliav Ran
2022-03-02 22:36:12

@Eliav Ran has joined the channel

Eliav Ran
2022-03-02 22:36:17

hey, i am trying to setup cucumber on nodejs server and everything is working 1 issue that i have is im trying to pass some env variables to the run i saw that ppl suggesting to pass it as world-parameters but this is jus adding things to the World instance i have workaround but im hopping theres a better way to do it

Aurélien Reeves
2022-03-03 01:36:51

*Thread Reply:* Could you give more info about what you are trying to achieve?

You want to update ENV as part of your run? To set some kind of default values, or forcing some specific values?

Eliav Ran
2022-03-03 01:39:24

*Thread Reply:* i want to pass env variable directly to the process.env from the cucumber.js or something similar

Eliav Ran
2022-03-03 01:39:55

*Thread Reply:* the screenshot is workaround

Aurélien Reeves
2022-03-03 01:43:50

*Thread Reply:* Why do you need to do that as part of the cucumber run? Setting appropriate ENV before executing the run is not an option?

Did you tried the BeforeAll hook? (https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/hooks.md#beforeall--afterall)

Eliav Ran
2022-03-03 01:45:56

*Thread Reply:* i wanted it to be as part of the settings and then it can be env changeable but if there is no option i will use the before all

Robert.S
2022-03-07 10:36:56

@Robert.S has joined the channel

Robert.S
2022-03-07 10:45:35

Hi, I’m new to JavaScript but I’m not new to Cucumber — been using the Java version for quite some time. I’ve structured my TypeScript project as follows

├── features │ ├── greeting.feature │ └── step_defiinitions │ └── steps.ts ├── package-lock.json ├── package.json ├── src │ ├── cucumber-js-example │ │ ├── cucumber.js │ │ └── index.ts │ └── resources └── tsconfig.json And, my package.json { "name": "typescript-examples", "version": "1.0.0", "description": "A collection of TypeScript example 'projects' used for experimentation", "scripts": { "test-cuke": "cucumber-js" }, "dependencies": { "@cucumber/cucumber": "^7.3.2", "@types/node": "^17.0.21" } } When I run npm run test-cuke I get the following

```> typescript-examples@1.0.0 test-cuke /Users/stagr005/workspace/typescript-examples > cucumber-js

UU

Failures:

1) Scenario: Say hello # features/greeting.feature:3 ? When the greeter says hello Undefined. Implement with the following snippet:

     When('the greeter says hello', function () {
       // Write code here that turns the phrase above into concrete actions
       return 'pending';
     });

? Then I should have heard "hello" Undefined. Implement with the following snippet:

     Then('I should have heard {string}', function (string) {
       // Write code here that turns the phrase above into concrete actions
       return 'pending';
     });

1 scenario (1 undefined) 2 steps (2 undefined)``` I’m not sure what I’ve misconfigured. But, I’m sure I overlooked something. Any guidance would be appreciated

Robert.S
2022-03-07 10:49:59

My steps.ts looks like ```import assert from 'assert';

import { When, Then } from '@cucumber/cucumber'; import { Greeter } from '../../src/cucumber-js-example';

interface MyWorld { whatIHeard: string; }

When('the greeter says hello', function (this: MyWorld) { this.whatIHeard = new Greeter().sayHello(); });

Then( 'I should have heard {string}', function (this: MyWorld, expectedResponse: string) { assert.equal(this.whatIHeard, expectedResponse); } );```

Joe A
2022-03-07 11:09:16

*Thread Reply:* think you need a cucumber.js file in your root directory

Joe A
2022-03-07 11:10:41

*Thread Reply:* I believe you need to use the --require-module ts-node/register flag. you could also add it to your test-cukes script i believe

Robert.S
2022-03-07 12:05:45

*Thread Reply:* Thanks @Joe A

Robert.S
2022-03-08 07:34:45

I’m working with the CucumberJS code using TypeScript. I’m new to JavaScript. I’ve laid out my features dir per “standard” structure and running the tests work just fine. Here’s what it looks like

├── cucumber.js ├── features │ ├── greeting.feature │ └── step_defiinitions │ └── steps.ts ├── package-lock.json ├── package.json ├── src │ ├── cucumber-js-example │ │ └── index.ts └── tsconfig.json Is it possible to move the features directory under src/cucumber-js-example directory ? And, if so, what configuration changes do I need to make in order to run the tests?

I tried placing features under src/cucumber-js-example, but that did not work. Each time I run the test, it returns 0 scenarios were executed.

David Goss
2022-03-09 04:45:01

*Thread Reply:* Hey @Robert.S, while as a general rule I would advise leaning into the defaults where possible, you can indeed have your features in whatever directory you like, you just need to tell cucumber by passing one or more globs as the positional arguments. So for your example say you are currently running cucumber-js &lt;your options&gt; You’d need to change to cucumber-js src/cucumber-js-example/features/****/**.feature &lt;your options&gt; Full docs are here https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md.

Robert.S
2022-03-09 12:03:13

*Thread Reply:* @David Goss, thanks for your help and pointing me to the documentation.

It would appear my earlier problem was a result of placing the path to the feature files in the wrong location within the cucumber.js file.

Here is what I had module.exports = { default: [ 'src/cucumber-js-example/features/****/**.feature', '--require-module ts-node/register', '--require src/cucumber-js-example/features/step_defiinitions/****/**.ts', '--publish-quiet', '--format @cucumber/pretty-formatter', ].join(' '), };

Robert.S
2022-03-09 12:04:13

*Thread Reply:* And, after you guidance, I updated it to be

module.exports = { default: [ '--require-module ts-node/register', '--require src/cucumber-js-example/features/step_defiinitions/****/**.ts', '--publish-quiet', '--format @cucumber/pretty-formatter', 'src/cucumber-js-example/features/****/**.feature', ].join(' '), }; And, it worked 😄 !!!. The path to features has be the last item in the list

matt-SmartBear
2022-03-09 21:33:40

*Thread Reply:* note that there are a few examples to refer to here: https://github.com/cucumber-examples/cucumber-js-examples

Language
Makefile
Last updated
2 months ago
Robert.S
2022-03-10 10:54:56

*Thread Reply:* thanks @matt-SmartBear. That’s the first resource I looked at. Unfortunately, the documentation does not mention anything about required placement of the ‘features’ path within the cucumber.js file

Akshu
2022-03-13 04:19:16

*Thread Reply:* @Robert.S Will it because of the typo in step_defiinitions?

Robert.S
2022-03-13 18:05:37

*Thread Reply:* Nope. it was due to the cucumber.js file

👍 Akshu
Nicholas Schudlo
2022-03-09 08:03:47

Hi! I'm using cucumber-js and I'm wondering if there is any way to know which tags have been used for filtering within the AfterAll hook? From my understanding the BeforeAll and AfterAll cannot be filtered with tags.

Nicholas Schudlo
2022-03-09 08:04:01

*Thread Reply:* My goal is to only run certain cleanup task in AfterAll if a certain tag is applied. I don't see any way to do that right now.

plocket
2022-03-11 08:01:47

We’re writing a package that has executables that we’re running with cucumberjs v7.3.2. When a dependent tries to run this script, the Steps are undefined: "./node_modules/.bin/cucumber-js --require ./node_modules/.bin/alkiln-cucumber"

The file to which that code refers is our “./lib/index.js” and this is what’s in that file: ```#!/usr/bin/env node

console.log('\n====\n====\n====\n====\nanything\n====\n====\n====\n====\n'); require('./world'); let foo = require('./steps.js');

console.log('foo:', foo);``` Nodes doesn’t throw any errors, but none of those console logs get logged. Other executables (they don’t use cucumber) work fine [and are in the same directory as the one that’s not logging]. Any ideas? Or maybe questions? Not sure what to include in here.

plocket
2022-03-16 12:07:28

*Thread Reply:* Giving this one a bump

matt-SmartBear
2022-03-17 11:14:19

*Thread Reply:* I'm surprised. The --require should require all JavaScript files in that folder at runtime.

matt-SmartBear
2022-03-17 11:14:31

*Thread Reply:* Can you try and create a minimal reproducible example on GitHub?

David Goss
2022-03-17 12:45:29

*Thread Reply:* I would be more surprised if requireing an executable like that worked, they aren’t designed for that. What’s stopping you from providing --require with the paths to the world and steps files?

David Goss
2022-03-18 02:07:49

*Thread Reply:* (I think Cucumber is probably treating ./node_modules/.bin/alkiln-cucumber as a directory not a file path, because it has no extension.)

plocket
2022-03-18 06:31:31

*Thread Reply:* These lines to run executables are working: "setup": "node_modules/.bin/alkiln-setup", "takedown": "node_modules/.bin/alkiln-takedown" That’s from the dependent’s package.json. Those lead to files, not directories. In our package that looks like: "bin": { "alkiln-setup": "./lib/docassemble/setup.js", "alkiln-takedown": "./lib/docassemble/takedown.js", "alkiln-cucumber": "./lib/index.js", }

plocket
2022-03-18 06:57:26

*Thread Reply:* Small reproducible example: https://github.com/plocket/exec-dependent

Last updated
15 minutes ago
David Goss
2022-03-19 03:41:14

*Thread Reply:* Thanks for the repro, added a PR here https://github.com/plocket/exec-dependent/pull/1

David Goss
2022-03-19 03:42:14

*Thread Reply:* Basically anything you pass to --require with no extension will be treated as a directory, not a file path, so you need to give it a path to the actual file(s) you want, not the executable script

plocket
2022-03-19 06:18:40

*Thread Reply:* Sorry that I didn’t actually repro the right issue and thanks for finding out about --require. Good thing to know in general 👍

👍 David Goss
David Goss
2022-03-19 06:23:15

*Thread Reply:* No problem! I think issues with configuration like this are too hard to diagnose at the moment, so I'm looking at adding a debug option to make it easier.

👀 plocket
matt-SmartBear
2022-03-22 11:00:14

*Thread Reply:* 💡

Mark W. Oosterveld
2022-03-12 09:23:49

@Mark W. Oosterveld has joined the channel

Mark W. Oosterveld
2022-03-12 09:56:25

Hey all! I'm trying to use cucumber-js 8.0.0-rc.2 with ES modules, and in the docs here: https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md I see there there is an --import option, but when I try to use it, i get the following error: error: unknown option '--import'

Mark W. Oosterveld
2022-03-12 09:56:56

*Thread Reply:* I'm guessing this feature hasn't been released yet? Any ideas when I can start using it?

David Goss
2022-03-13 13:07:22

*Thread Reply:* Hey @Mark W. Oosterveld, rc3 should be out in the next few days with that available

Mark W. Oosterveld
2022-03-13 13:07:46

*Thread Reply:* thanks. Will it support typescript?

Mark W. Oosterveld
2022-03-13 13:08:39

*Thread Reply:* I'm starting a new (hobby) project, and I plan to use ESM and Typescript

David Goss
2022-03-13 13:19:06

*Thread Reply:* Not yet but I’ll be looking at that next. Oddly enough just commented here https://github.com/cucumber/cucumber-js/issues/1844#issuecomment-1066174669

Mark W. Oosterveld
2022-03-13 13:30:23

*Thread Reply:* thanks for all your hard work!

Sander Pacheco
2022-03-13 22:56:58

@Sander Pacheco has joined the channel

Sten Aksel Heien
2022-03-14 01:28:01

@Sten Aksel Heien has joined the channel

Erik
2022-03-15 08:15:53

@Erik has joined the channel

Erik
2022-03-15 08:19:26

Hi there, What are the best practices used to gracefully fail a test run in the BeforeAll hook when using it with TypeScript? Features with Scenarios should not be executed but the AfterAll hook should be executed.

David Goss
2022-03-15 18:17:49

*Thread Reply:* I don’t think we have a first-class way to support this now, but you might be able to work around it, something like:

```// runs once before everything BeforeAll(() => { process.env.BAILONTEST_RUN = 'true' })

// runs before each scenario and can skip it Before(() => { if (process.env.BAILONTEST_RUN === 'true') { return 'skipped' } })```

👍 Erik
David Goss
2022-03-15 18:18:28

*Thread Reply:* This should be a bit less clunky once https://github.com/cucumber/cucumber-js/pull/1770 is finished and we have a global test run context.

Labels
✅ accepted, ⚡ enhancement
Comments
8
Manuela Mag
2022-03-17 01:45:51

Hello, I was wondering if you could help me. What would be the best package for installing the chrome driver? I tried a few, but over time I'm getting this error : SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 97 Current browser version is 99.0.4844.74 with binary path Is there a way to install it without being dependent on some fixed version of chrome?

Jim Trenowden
2022-03-17 01:52:37

*Thread Reply:* Personally I like this package, it allows you to set a property in your .npmrc file that always installs the latest version of chromedriver https://www.npmjs.com/package/chromedriver

npm
Manuela Mag
2022-03-17 02:00:27

*Thread Reply:* Thank you! Could you also tell me which property is that? And how to find that file? I'm using a macOs big sur

Jim Trenowden
2022-03-17 02:09:12

*Thread Reply:* No problem! The property is chromedriver_version=LATEST, you would have to create a .npmrc file in your project (that is, assuming your project is a NodeJS one?): https://docs.npmjs.com/cli/v8/configuring-npm/npmrc

docs.npmjs.com
Manuela Mag
2022-03-17 02:10:47

*Thread Reply:* so the file should be in the project locally?

Jim Trenowden
2022-03-17 02:11:28

*Thread Reply:* That’s right, usually at the top level

Jim Trenowden
2022-03-17 02:12:35

*Thread Reply:* It’s worth noting that this package will install chromedriver in your project’s node_modules folder, I personally like that but some people prefer it to be installed globally somewhere

Manuela Mag
2022-03-17 02:14:06

*Thread Reply:* i think it's quite useful to have this file with that property, so I would not have to change manually the chrome version each time it becomes deprecated

Manuela Mag
2022-03-17 02:14:44

*Thread Reply:* What else should the file contain? I'm searching right now some example, but i didn't find a good one yet

Jim Trenowden
2022-03-17 02:19:12

*Thread Reply:* It doesn’t need to contain anything else unless you want it to, it only exists to pass config to npm packages when you’re installing, so the file can just have the above mentioned property in it (unless you have other properties you want to override)

Manuela Mag
2022-03-17 03:01:00

*Thread Reply:* okay, I will try that. Thanks!

Mona Ghassemi
2022-03-21 05:39:58

*Thread Reply:* Hmm I used to use the latest flag I think, but I reverted to changing versions manually because chromedriver always updates before the latest version of chrome is available for download. 😞

Jim Trenowden
2022-03-21 06:22:32

*Thread Reply:* There’s always going to be the potential for the browser and driver versions to get out of sync, the only way I’ve been able to consistently keep them in line is to install Chromium as a dependency in my project as well, and make sure that the version of Chromium matches the version of Chromedriver. Then I can bump them to newer versions at the same time when I choose to do so

🤔 Mona Ghassemi
Rabin
2022-03-17 15:06:19

@Rabin has joined the channel

Rabin
2022-03-17 15:07:34

Any idea ?? What is wrong Undefined:implements of following snippet

Joe A
2022-03-17 15:16:10

*Thread Reply:* cucumber doesn’t know where to look for the steps.

Rabin
2022-03-17 15:25:26

*Thread Reply:* I create step-defination folder and create login.js file

Joe A
2022-03-17 15:26:41

*Thread Reply:* /step_definitions/

Joe A
2022-03-17 15:26:47

*Thread Reply:* spelled like that?

Rabin
2022-03-17 15:27:41

*Thread Reply:* Yes

Joe A
2022-03-17 15:28:45

*Thread Reply:* can you post a screenshot

Rabin
2022-03-17 15:29:34

*Thread Reply:* Joe A i will send ss later iam out of room now

Joe A
2022-03-17 15:29:52

*Thread Reply:* Sounds good. Need more information to help you

plocket
2022-03-18 06:59:08

*Thread Reply:* What do your step definition files look like?

Rabin
2022-03-18 07:00:54

*Thread Reply:* This is step-definition

plocket
2022-03-18 07:07:41

*Thread Reply:* Just fyi, that last one (with password) has a typo or two. I think Joe A is right in general, though - it looks like the code isn’t finding that file. Where do you require the different files? And what does your package.json scripts look like?

plocket
2022-03-18 07:10:57

*Thread Reply:* One file to see is your index.js file

Joe A
2022-03-18 08:48:47

*Thread Reply:* The file is spelled incorrectly for cucumber to find it without a setting. the image says step-definAtion but cucumber will only look for step_definItion unless you tell it otherwise (I believe)

plocket
2022-03-18 08:50:39

*Thread Reply:* Wow, nice catch

Rabin
2022-03-18 09:01:59

*Thread Reply:* Apperception for help i got it

Joe A
2022-03-18 09:02:30

*Thread Reply:* 👍

Pratik Gundlupet Venkatesh
2022-03-18 00:51:27

@Pratik Gundlupet Venkatesh has joined the channel

daniel hartley
2022-03-20 02:03:45

@daniel hartley has joined the channel

LayMui
2022-03-20 23:05:06

how can I share the state in the Given When and Then step using cucumber-js?

LayMui
2022-03-20 23:05:50

*Thread Reply:* here is the code snippet: ```When(

'{pronoun} select a country code and provide a valid mobile number',

async (actor: Actor, table: DataTable) => {

const countryCode = table.hashes()[0].countryCode;

const mobileNumber = table.hashes()[0].mobileNumber;



await LoginPage.selectCountryCode();

await LoginPage.enterMobileNumber(mobileNumber);



await LoginPage.continueToOTP();

await LoginPage.waitForOTPToProcess();

},

);

Then('{pronoun} is able to verify using OTP', async (actor: Actor) => {

// need to get the value countryCode and mobileNumber from the When step

const date = new Date();

 const timeStamp = date.toUTCString();

 <a href="http://console.info">console.info</a>('timestamp : ' + timeStamp + '\ncountryCode: ' + countryCode + '\nmobileNumber: ' + mobileNumber)

 const OTP = await LoginPage.readOTP(timeStamp, countryCode + mobileNumber);

 <a href="http://console.info">console.info</a>('OTP Number : ' + OTP);

 await LoginPage.enterOTPInput(OTP);

});```

Aurélien Reeves
2022-03-21 00:25:29

*Thread Reply:* This is tipically the job of the world: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md

👌 David Goss
👍 Joe A, Tom M
Rabin
2022-03-21 09:41:10

How can define connection-config json value in nightwatch browser.assert.equal(data.connection-config.ip,’192.168.1.1’)

Rabin
2022-03-21 09:41:59

Is given error config is not defined

delso
2022-03-21 18:08:28

@delso has joined the channel

Manuela Mag
2022-03-22 02:54:23

Hi, I was wondering if you could help me. I'm facing an issue, because of the info bar "Chrome is being controlled by automated test software" the buttons from the bottom of the page are not visible. I tried this to make the info bar disappear, but it didn't work : var webdriver = require('selenium-webdriver');

var chromeCapabilities=webdriver.Capabilities.chrome()

chromeCapabilities.set('chromeOptions', "disable-infobars"); driver = new webdriver.Builder() .withCapabilities(chromeCapabilities) .forBrowser('chrome') .build(); . Is there another way to make the info bar not appear anymore? I tried as well excludeSwitches: ['enable-automation'] , same results. The bar is still there

Jim Trenowden
2022-03-23 02:43:58

*Thread Reply:* I’m not aware of a way to do this, might it be easier to increase the default size of the viewport by the height of the info bar?

Manuela Mag
2022-03-23 05:38:22

*Thread Reply:* I manage to do that work around. Thanks!

Jim Trenowden
2022-03-23 06:11:36

*Thread Reply:* No problem!

Rabin
2022-03-23 11:25:34

Runner.startWebDriver is not a function

Joe A
2022-03-23 11:36:58

*Thread Reply:* I think this is an issue with chrome web driver, not cucumber.

Joe A
2022-03-23 11:37:09

*Thread Reply:* Likely, it’s not being imported or required

Rabin
2022-03-23 11:37:42

*Thread Reply:* Thank you sir

Joe A
2022-03-23 11:37:56

*Thread Reply:* can you show a picture of cucumber.conf.js ?

Rabin
2022-03-23 11:38:46

*Thread Reply:*

Joe A
2022-03-23 11:42:44

*Thread Reply:* Yeah that’s a problem with Nightwatch-api.

Joe A
2022-03-23 11:43:34

*Thread Reply:* You might have better luck asking on their github or if they have a slack

Rabin
2022-03-23 11:43:50

*Thread Reply:* Sure

Ravi Sawlani
2022-03-29 05:43:08

*Thread Reply:* @Rabin There is a built in support for cucumber in nightwatch itself maybe you can use that

Jerry Yu
2022-03-23 20:16:43

@Jerry Yu has joined the channel

vidya
2022-03-25 05:43:48

@vidya has joined the channel

vidya
2022-03-28 13:02:02

Hi all, I am looking for help on running scenarios in parallel where only single login allowed per user using Cucumber+Selenium+nodejs? I cannot find any solid documentation on this. Or Is it possible using Selenium Grid? Is there any working solution available?

David Goss
2022-04-06 14:07:59

*Thread Reply:* Hard to know without more details but the new functionality (just released in 8.0.0) around custom work assignment might help you https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md#custom-work-assignment - you might be able to allow parallel execution generally whilst limiting your constrained-user scenarios to one at a time

Ravi Sawlani
2022-03-29 05:32:34

@Ravi Sawlani has joined the channel

Ravi Sawlani
2022-03-29 05:33:05

Hi all, I have been using json formatter in cucumber and sometimes the it throws a type error inside cucumber here: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/json_formatter.ts#L278 it says testStepResult is undefined

Tom M
2022-03-29 09:53:38

@Tom M has joined the channel

John Ringler
2022-03-30 09:43:50

Hello, is there a way to get the example id from a Scenario Outline? Let me explain: let’s assume I have the following test:

```Scenario Outline: eating Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers

Examples: | start | eat | left | | 12 | 5 | 7 | | 20 | 5 | 15 |`` At the end of the test, my automation creates aeating.json` file with some output from the test. This works great for Scenario but for Scenario Outline, I would like to end up with 2 output files (one for each scenario in the Scenario Outline):

  • eating-example-1.json
  • eating-example-2.json

Similarly, is there a way to get the retry id when running cucumber-js with the retry option? For example, if I run a test with the command: cucumber-js --retry 2 and the test is indeed retried twice, what can I do so that my test will write 3 files:

  • test.json
  • test-retry-1.json
  • test-retry-2.json

Again, for my purpose, I need the example id and retry id. It doesn’t look like I can get either of these values at the scenario level from scenario.gherkinDocument, scenario.pickle or scenario.result.

Joe A
2022-03-30 09:50:59

*Thread Reply:* Haven’t tried to do anything like this yet and someone will probably have better advice. That being said, this sounds like an afterEach hook deal. Creating some function that writes a file. I’m not sure if afterEach hooks will run if you’re doing a scenario outline, or if the tests need to be separate.

John Ringler
2022-03-30 09:58:39

*Thread Reply:* Thanks for the reply. I already after that function in place in my After(scenario) hook. I am able to write a file after each scenario completes and I can even append a test case ID generated by cucumber-js using something like: After((scenario) =&gt; { const filename = `${scenario.pickle.name}-${scenario.testCaseStartedId}`; fs.writeFile(`./tests-output/${filename}.json`, outputData, (err) =&gt; { if (err) { throw new Error(err); } });

Joe A
2022-03-30 10:03:12

*Thread Reply:* But if you already had something like that in place, you could add state to your cucumber world to keep track of the “id”.

example: this.counter = 0; fs.fileWrite(`./tests-output/${filename}_${counter}.json`); this.counter++;

John Ringler
2022-03-30 10:17:40

*Thread Reply:* Yeah, unfortunately, adding a counter doesn’t tell me if the file created is the result of a retry or an example in Scenario Outline.

Joe A
2022-03-30 10:18:34

*Thread Reply:* Is there info about whether the test failed or passed in the after step?

John Ringler
2022-03-30 10:19:14

*Thread Reply:* Yes, I can get the following when doing a console.log(result):

John Ringler
2022-03-30 10:19:21

*Thread Reply:* { duration: { seconds: 1, nanos: 971000000 }, status: 'PASSED', message: undefined, willBeRetried: false }

Joe A
2022-03-30 10:21:52

*Thread Reply:* You can use state to manage that as well. this.isRetry = status === failed; if (this.isRetry) { fs.fileWrite(`./tests-output/${filename}_${retry}_${counter}.json`); }

Joe A
2022-03-30 10:22:02

*Thread Reply:* obviously that code won’t work directly but you get the idea.

Joe A
2022-03-30 10:22:12

*Thread Reply:* If the counter > 2, reset both states

John Ringler
2022-03-30 10:26:05

*Thread Reply:* I can do something like that. You’re on the right track (we just need to handle the case where status === FAILED but there is no more retry after that i.e. willBeRetried === false ). I was just hoping that cucumber-js offered that out of the box.

Joe A
2022-03-30 10:27:01

*Thread Reply:* Oh yeah, that I’m not so sure about it.

John Ringler
2022-03-30 10:28:52

*Thread Reply:* That works for the retries. I can implement a similar mechanism for examples in a Scenario Outline. I think we can conclude that a scenario is an example if the scenario name is the same.

Alvaro Monferrer
2022-03-31 00:03:13

@Alvaro Monferrer has joined the channel

Tim Yao
2022-04-03 21:39:23

Hi, is there a built-in way to run the cucumber-js tests in a data-driven way with an external data sheet? I don’t want to hardcode the data by datatable or scenario outline and examples .

David Goss
2022-04-03 23:55:46

*Thread Reply:* There isn't at the moment.

David Goss
2022-04-03 23:56:22

*Thread Reply:* Right now the best workaround is probably to template your feature file and have a pre test step that generates it with your data inlined.

David Goss
2022-04-03 23:56:35

*Thread Reply:* There is a proposal here if you want to weigh in https://github.com/cucumber/common/issues/773

Labels
platform consolidation, 🧷 pinned, milestone-proposal
Comments
16
Tim Yao
2022-04-04 00:01:58

*Thread Reply:* Thanks @David Goss. That’s helpful information. Right now the best workaround is probably to template your feature file and have a pre test step that generates it with your data inlined. I think that means setting the data into context for the scenario to use.

Tim Yao
2022-04-04 00:03:48

*Thread Reply:* I can use before hooks🤔 . If I want it to be global.

David Goss
2022-04-04 01:31:17

*Thread Reply:* No, what I meant was having your feature file exist in your repo as a template (e.g. handlebars or mustache), and having a little script or build step that uses the template to generate a feature file with an examples data from all the data, then running cucumber after that.

David Goss
2022-04-04 01:31:29

*Thread Reply:* (whatever works for you though!)

Tim Yao
2022-04-04 16:40:51

*Thread Reply:* ahh, I get what you mean now. Yes, all good, I think there are multiple options. But there is no built-in solution which is what I initially asked for.

Luděk Nový
2022-04-04 04:17:46

Hi. Just upgraded to v8 rc3, and have issues with my custom formatter (.ts). I have it hooked up like this: ``module.exports = { default:${common} --format progress-bar, ci:${common} --format ./folder/tcFormatter.ts `

}`` it throws an error:TypeError [ERRUNKNOWNFILE_EXTENSION]: Unknown file extension ".ts"`

and it worked just fine with v7. Any ideas?

Luděk Nový
2022-04-04 06:15:50

*Thread Reply:* I ended up by creating npm package for it, and publishing it to the npm private registy.

David Goss
2022-04-04 12:03:02

*Thread Reply:* Yep that was going to be my suggested workaround.

David Goss
2022-04-04 12:04:20

*Thread Reply:* But I think we can fix before 8.0.0. I don’t think we anticipated that custom formatters might be written in TS and effectively benefit from ts-node being require’d via --require-module earlier in the process. We should be able to rework to accomodate

👍 Luděk Nový
David Goss
2022-04-04 14:09:12

*Thread Reply:* here we go https://github.com/cucumber/cucumber-js/pull/1985

Comments
1
Milestone
<a href="https://github.com/cucumber/cucumber-js/milestone/14">ESM</a>
👀 Luděk Nový
Luděk Nový
2022-04-05 01:23:17

*Thread Reply:* @David Goss Thanks for the quick fix! Will check later today

Ravi Sawlani
2022-04-04 05:30:37

Hi all 👋 , I have a test where I am creating an instance of Cucumber Cli it works but when I try to run all tests together steps becomes undefined as if there is no step definition file provided. I think it’s because not clearing require cache, tried that too doesn’t work do we have any other way to clear supportFiles?

David Goss
2022-04-06 13:53:21

*Thread Reply:* You might find using the new runCucumber API helps with this, since you can load the support code once and use it on multiple runs in the same process

https://github.com/cucumber/cucumber-js/blob/main/docs/javascript_api.md

👍 Ravi Sawlani
David Goss
2022-04-06 13:49:38

📢 cucumber-js 8.0.0 is out https://cucumber.io/blog/open-source/announcing-cucumber-js-8-0-0/ - please give it a try and feed back if you can!

Cucumber.io
🎉 Aurélien Reeves, Luděk Nový, Jo Laing, plocket, Tim Yao, Jim Trenowden, SantoshK
Aurélien Reeves
2022-04-06 16:27:46

*Thread Reply:* Great post, congrats!

Kwame
2022-04-08 13:04:45

@Kwame has joined the channel

Venkatesh Salagrama
2022-04-11 01:31:45

@Venkatesh Salagrama has joined the channel

Marieh Musimenta
2022-04-21 03:05:53

@Marieh Musimenta has joined the channel

Cristiano Caetano
2022-04-21 06:04:11

@Cristiano Caetano has joined the channel

Hatch
2022-04-27 09:17:59

@Hatch has joined the channel

Hatch
2022-04-27 09:19:17

Hi folks, I just joined a company that is using cucumber + nightwatch.js. I’ve not used cucumber before so am learning as much as I can. Recently one of our developers changed some of the development files in the repo to typescript files. Our cucumber files are still in js. When I try to run our tests, cucumber can’t find the new typescript files that are dependencies. Has anyone else run into this?

Mona Ghassemi
2022-04-27 09:47:43

*Thread Reply:* You can configure cucumber.js to require your ts files

Mona Ghassemi
2022-04-27 09:48:27

*Thread Reply:* I have the following for a repo using ts: const common = [ "--require-module ts-node/register", "--require test.setup.ts", // Load hooks "--require features/stepDefinitions/****/**.ts", // Load step definitions "--format progress", // Load custom formatter ].join(" ");

Hatch
2022-04-27 09:49:12

*Thread Reply:* Is that in your cucumber config file?

matt-SmartBear
2022-05-02 13:37:19

*Thread Reply:* @Hatch yes that would be in your cucumber.js config file

👍 Mona Ghassemi
matt-SmartBear
2022-05-02 13:37:37

*Thread Reply:* you can just pass those options on the CLI if you want to try it out, but it's easier to have them save off as default

matt-SmartBear
2022-05-02 13:38:32

*Thread Reply:* Did you figure this out in the end?

Mona Ghassemi
2022-05-03 06:37:07

*Thread Reply:* Sorry I missed the follow-up question; I could have been more explicit.

Jp van Zyl
2022-04-27 23:35:04

@Jp van Zyl has joined the channel

prashant patel
2022-04-28 06:58:17

@prashant patel has joined the channel

Jim Trenowden
2022-05-02 02:21:31

Hi folks, we run Cucumber JS tests in our deployment pipeline, which uses AWS CodePipeline / CodeBuild. Since migrating to Cucumber 8 (we're now on 8.1.2) we're seeing the step that uploads and parses the results json file fail with the below message. Has something changed with the formatting of the duration field since versions 7.x?

Error in UPLOAD_ARTIFACTS phase: [system: [error processing report: [/codebuild/output/src381885655/src/reports/system/cucumber.json: json: cannot unmarshal number 253118.99999999997 into Go struct field Result.elements.steps.result.duration of type time.Duration]]]

Jim Trenowden
2022-05-02 02:22:59

*Thread Reply:* I should note that I've still got some projects using Cucumber 7 and that upload step passes

matt-SmartBear
2022-05-02 13:35:45

*Thread Reply:* I see from the CHANGELOG (https://github.com/cucumber/cucumber-js/blob/main/CHANGELOG.md#changed-4) that this was included in the v8 release: https://github.com/cucumber/cucumber-js/pull/1793

matt-SmartBear
2022-05-02 13:36:23

*Thread Reply:* Maybe that's the culprit?

Jim Trenowden
2022-05-02 13:40:02

*Thread Reply:* Aha, well spotted! Looks like the number of decimal places should have been capped as part of that work, I wonder if something's regressed since the feedback was addressed?

Aurélien Reeves
2022-05-03 00:22:11

*Thread Reply:* It seems you are using a tool written in Go to process the json. Is it one issued from cucumber? Or something else?

Jim Trenowden
2022-05-03 01:12:41

*Thread Reply:* It’s AWS CodeBuild’s built in test report processor, which I can only assume is written in Go: https://docs.aws.amazon.com/codebuild/latest/userguide/test-reporting.html

docs.aws.amazon.com
Aurélien Reeves
2022-05-03 01:52:39

*Thread Reply:* Ok, thanks

I guess we may submit an issue there, or even a PR, to support the new duration precision of cucumber-js

Aurélien Reeves
2022-05-03 06:26:15

*Thread Reply:* I though that was a link to a github repo

Trying to find one. Not sure this is actually open-source

Aurélien Reeves
2022-05-03 08:12:26

*Thread Reply:* Just submit an issue here: https://github.com/awsdocs/aws-codebuild-user-guide/issues/91

Jim Trenowden
2022-05-04 00:52:51

*Thread Reply:* Awesome, thank you! Hopefully that will get the ball rolling on a fix. In the meantime I’ve had to downgrade to 7.3.2, which is a shame

Jorge León Delgado
2022-05-04 01:24:41

@Jorge León Delgado has joined the channel

oak155online
2022-05-04 01:50:34

@oak155online has joined the channel

LayMui
2022-05-10 04:51:35

how can I have more than 1 tag expression. I used tagExpression: [‘@universal’, ‘@embedded’], it does not work, it give me this error

LayMui
2022-05-10 04:53:13

*Thread Reply:* test:execute:android] [0-0] at tokenize (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/nodemodules/@cucumber/tag-expressions/src/index.ts:86:20) [test:execute:android] [0-0] at Object.parse [as default] (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/nodemodules/@cucumber/tag-expressions/src/index.ts:23:18) [test:execute:android] [0-0] at new PickleTagFilter (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/nodemodules/@cucumber/cucumber/src/picklefilter.ts:128:37) [test:execute:android] [0-0] at new PickleFilter (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/nodemodules/@cucumber/cucumber/src/picklefilter.ts:36:22) [test:execute:android] [0-0] at new CucumberAdapter (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/build/index.js:79:30) [test:execute:android] [0-0] at Object.adapterFactory.init (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/cucumber-framework/build/index.js:319:21) [test:execute:android] [0-0] at Runner.run (/Users/a845751yara.com/dev/sh-usermanagement-native-poc/nodemodules/@wdio/runner/build/index.js:83:49) [test:execute:android] [0-0] at processTicksAndRejections (node:internal/process/taskqueues:96:5) [te

LayMui
2022-05-10 04:53:28

*Thread Reply:* here is the complete set of cucumber opts in the wdio config file

LayMui
2022-05-10 04:53:48

*Thread Reply:* // If you are using Cucumber you need to specify the location of your step definitions. cucumberOpts: { // &lt;string[]&gt; (file/dir) require files before executing features require: ['./tests/src/****/**.ts'], // &lt;boolean&gt; show full backtrace for errors backtrace: false, // &lt;string[]&gt; ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable) requireModule: [], // &lt;boolean&gt; invoke formatters without executing steps dryRun: false, // &lt;boolean&gt; abort the run on first failure failFast: false, // &lt;string[]&gt; (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable) format: ['pretty'], // &lt;boolean&gt; hide step definition snippets for pending steps snippets: true, // &lt;boolean&gt; hide source uris source: true, // &lt;string[]&gt; (name) specify the profile to use profile: [], // &lt;boolean&gt; fail if there are any undefined or pending steps strict: false, // &lt;string&gt; (expression) only execute the features or scenarios with tags matching the expression tagExpression: ['@universal', '@embedded'], // &lt;number&gt; timeout for step definitions timeout: 1000000, // &lt;boolean&gt; Enable this config to treat undefined definitions as warnings. ignoreUndefinedDefinitions: false, },

David Goss
2022-05-10 12:44:57

*Thread Reply:* I’m not sure what mapping might be happening with wdio, but for Cucumber the tags config option is a single string, not an array.

You might want something like '@universal and @embedded'

David Goss
2022-05-10 12:47:48

*Thread Reply:* (I just fixed a typo in that first doc that made it slightly misleading - apologies if that’s what you were going off!)

LayMui
2022-05-10 22:32:36

*Thread Reply:* it didn’t work. i can only use tagExpression = ‘@embedded’

LayMui
2022-05-10 22:32:50

*Thread Reply:* not tagExpression ‘@embeded and @universal’

LayMui
2022-05-10 22:35:41

*Thread Reply:* I am using @cucumber/cucumber. ^7.3.2

LayMui
2022-05-12 19:22:59

*Thread Reply:* issue resolved by using ‘or’. not ‘and’

Jolivé
2022-05-10 09:08:48

@Jolivé has joined the channel

Surya
2022-05-12 05:30:08

@Surya has joined the channel

Angelo Huaraca
2022-05-26 06:44:53

Dou you know any library to work cypress with cucumber ?

David Goss
2022-05-26 06:50:12

*Thread Reply:* https://github.com/badeball/cypress-cucumber-preprocessor

Stars
1015
Language
TypeScript
Angelo Huaraca
2022-05-26 09:56:13

*Thread Reply:* I thought that library was deprecated hahaha https://github.com/badeball/cypress-cucumber-preprocessor-deprecated yesterday I saw the URL without "-deprecated" but it said deprecated in its content or my bad, i dont know 😅

Stars
9
Language
TypeScript
Angelo Huaraca
2022-05-26 09:58:15

*Thread Reply:* Thank you!

👍 David Goss
plocket
2022-05-27 07:22:40

Sorry to come here with this question, but I’ve seen a lot of people in here talking about puppeteerjs and I’m not sure where else to go. I’m using puppeteer’s page.on('response'…) listener, but I can’t see any of the console logs I make in there. Does anyone know how I can see those logs? I’m trying to rename a file I download and it’s not working at all - nothing’s happening to the name whatsoever. I’m trying to log to troubleshoot, but I don’t see any logs in the command prompt or in the browser running in headless mode. Here’s the code before I’ve added the logs: https://github.com/SuffolkLITLab/ALKiln/blob/552_artifacts_dirs/lib/steps.js#L214. Strangely enough, I do think the Step does wait for the doc to finish downloading because the process waits the appropriate amount of time before exiting.

Eliav Ran
2022-05-30 23:48:23

is there extension that shows and able to run each test seperate ? like there is in jest ?

David Goss
2022-05-31 01:06:46

*Thread Reply:* Not that I know of. @Aslak Hellesøy would this ever be in scope of our VSCode extension in future?

Aslak Hellesøy
2022-05-31 08:40:04

*Thread Reply:* @Eliav Ran @David Goss there is an issue you can monitor here: https://github.com/cucumber/vscode/issues/69

👍 David Goss
Ben Jefferies
2022-06-01 23:40:22

@Ben Jefferies has joined the channel

Ben Jefferies
2022-06-01 23:51:40

Hey everyone, I'm trying to get the index of the scenario outline example that is currently running in a Before or BeforeStep hook. Has anyone successfully done this? I can see that there has been some chat around making the API nicer but couldn't find anything else?

David Goss
2022-06-03 01:41:21

*Thread Reply:* Hey, you might want to check the example in this issue https://github.com/cucumber/cucumber-js/issues/1851 which I think might be what you need.

Also, would be great if you could comment there with your use case - we’ll definitely do something to address this, just want to make sure it solves the right problem.

Comments
1
❤️ Ben Jefferies
Youri D.B.
2022-06-05 13:15:12

@Youri D.B. has joined the channel

Youri D.B.
2022-06-05 13:20:07

Hello all ! Wondering if someone got cypress cucumber running for a large enterprise application. I started creating this big global gherkin dictionary so it could be used in the tests, but now I just read it is actually discouraged to use global step definitions ? Do any of you create step definitions for each feature file ?

David Goss
2022-06-06 01:28:31

*Thread Reply:* Yep - much more neutral advice there. The Cucumber position is essentially that a global namespace forces you to be deliberate and specific about your terminology, and helps highlight when things get conflated and misused. I think @matt-SmartBear had some good quotes.

matt-SmartBear
2022-06-06 07:29:49

*Thread Reply:* There is some more context here: https://github.com/cucumber/common/issues/1949

Comments
11
Youri D.B.
2022-06-06 14:26:19

*Thread Reply:* Ha 🤔interesting discussion/view on things. I might indeed start out to let the team write more feature specific gherkin, and avoid hacky generic language. Thnx for the link !

slackbot
2022-06-05 13:20:08

Guten tag! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Tim Yao
2022-06-08 03:12:36

Hi all, which cucumber formatter can output a simple summary to a json or text file? All I want is how many tests failed. I then will let CI to post it as a Slack message. Like: 3 tests failed out of 10 I tried to use summary formatter, like --format summary:report/summary.txt But the output contains a lot of special characters & shell color code, which was rejected by Slack.

David Goss
2022-06-08 03:24:02

*Thread Reply:* hmm - it shouldnt include the ascii color stuff if you direct it to a file. which version of cucumber-js?

David Goss
2022-06-08 03:24:17

*Thread Reply:* (we did fix something with this recently)

Tim Yao
2022-06-08 03:27:03

*Thread Reply:* cucumber/cucumber@7.3.1

Tim Yao
2022-06-08 03:27:14

*Thread Reply:* Is there a better way?

Tim Yao
2022-06-08 03:28:02

*Thread Reply:* Like build mine own report by using messages? I just don't quite understand how messages works for this.

Tim Yao
2022-06-08 03:28:40

*Thread Reply:* The docs https://github.com/cucumber/common/tree/main/messages is not built for that purpose I think.

David Goss
2022-06-08 03:29:04

*Thread Reply:* try the latest (8.2.2) - we put some better handling in for when (not) to emit colors based on the output stream and other stuff

Comments
3
David Goss
2022-06-08 03:29:32

*Thread Reply:* (sending the summary formatter to a file seems a good low effort way to do this. but yeah you could do a custom formatter also)

Tim Yao
2022-06-08 03:30:55

*Thread Reply:* thanks. install v8.2.2 now

Tim Yao
2022-06-08 03:31:41

*Thread Reply:* I just couldn't find a straightforward tutorial/example for how to use message to build my custom report.

Tim Yao
2022-06-08 03:33:26

*Thread Reply:* I guess some API changed in V8? I now get error Error: Cannot find module '/node_modules/@cucumber/cucumber/lib/formatter/helpers.js'

Tim Yao
2022-06-08 03:35:23

*Thread Reply:* nvm, updated pretty formatter and fixed it

Tim Yao
2022-06-08 03:35:50

*Thread Reply:* cool. I can see the special chars & color code are gone.

Tim Yao
2022-06-08 03:36:01

*Thread Reply:* Try Slack post now

Tim Yao
2022-06-08 03:44:54

*Thread Reply:* parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 9, column 24 still fail on slack

Tim Yao
2022-06-08 05:44:54

*Thread Reply:* I think it's due to some jq and JSON format issue in the Slack integration. I end up writing my own from parsing the old JSON formatter.

Tim Yao
2022-06-08 05:45:20

*Thread Reply:* It's not ideal, but works for now.

👍 David Goss
plocket
2022-06-10 09:06:01

I’ve got an error in my Before that’s not giving me any info. The rest of the Scenario runs and all the steps pass, but the scenario itself fails. Here’s what I see in the console (line 121 is where the Before( starts and I don’t get anything more specific than that):

plocket
2022-06-10 09:07:22

*Thread Reply:* How do I troubleshoot this?

plocket
2022-06-10 09:11:55

*Thread Reply:* When I console log in various places in the Before() callback, all the logs get logged.

Joe A
2022-06-10 09:23:47

*Thread Reply:* What is at line 121 in lib/steps.js?

plocket
2022-06-10 09:24:03

*Thread Reply:* Before(async (scenario) =&gt; {

Joe A
2022-06-10 09:24:22

*Thread Reply:* Are you importing Before?

plocket
2022-06-10 09:24:29

*Thread Reply:* Yes

Joe A
2022-06-10 09:24:55

*Thread Reply:* Not sure without more context

plocket
2022-06-10 09:25:41

*Thread Reply:* This package has been working for a while and this is a new bug. I’m not sure how to track it down because there’s so little information. It’s a pretty big package. Is there more I can tell you?

Joe A
2022-06-10 09:26:28

*Thread Reply:* Do you have a git diff of when it was working vs now?

plocket
2022-06-10 09:27:24

*Thread Reply:* Yes. I was working out a merge conflict. I’ll paste it.

plocket
2022-06-10 09:28:11

*Thread Reply:* Hmm, Slack changed. Can’t find how to add a code snippet, so this’ll be a long code block…

plocket
2022-06-10 09:28:17

*Thread Reply:* ```git diff diff --cc .github/workflows/testtests.yml index 8643da4,97f6f16..0000000 --- a/.github/workflows/testtests.yml +++ b/.github/workflows/test_tests.yml diff --cc action.yml index aadaccc,c700978..0000000 --- a/action.yml +++ b/action.yml diff --cc lib/scope.js index 61a15db,e409330..0000000 --- a/lib/scope.js +++ b/lib/scope.js @@@ -60,21 -63,7 +63,25 @@@ module.exports = let scenario = await scope.makeSureReportPartsExist( scope ); scenario.lines.push({ type, value });

  • log.addtodebug_log(Report:\ntype: ${ type }, value: ${ value }\n); ++// <<<<<<< HEAD
  • // Ensure filepath for saving local unit test logs
  • if ( !scope.paths ) {
  • // TODO: would it be useful to put in existing artifacts folder if possible. Can this be usefully
  • // abstracted?
  • let date = await scope.dateforfilename();
  • scope.paths = { debug_log: _alkiln_test-misc_artifacts/unit_tests_logs-${ date }.txt };
  • } +
    • try {
    • fs.appendFileSync(scope.paths.debuglog, \nReport:\ntype: ${ type }, value: ${ value });
    • } catch (err) {
    • fs.mkdirSync(_alkiln_test-misc_artifacts);
    • fs.appendFileSync(scope.paths.debuglog, \nReport:\ntype: ${ type }, value: ${ value });
    • } ++// try { ++// fs.appendFileSync(, \nReport:\ntype: ${ type }, value: ${ value }); ++// } catch (err) { ++// fs.mkdirSync(_alkiln_test-misc_artifacts); ++// fs.appendFileSync(scope.paths.debug_log, \nReport:\ntype: ${ type }, value: ${ value }); ++// }
  • ++// ======= ++ log.addtodebuglog( Report:\ntype: ${ type }, value: ${ value }\n, scope.paths.debuglog ); ++// >>>>>>> releases/v4 return scenario;

    }, // Ends scope.addToReport() @@@ -504,6 -478,44 +511,45 @@@ await scope.tapElement( scope, elem, tab_id ); },

    • checkForA11y: async function (scope ) {
    • /** Return if there were any violations and the file containing aXe output with more details of the checks **/
    • let { id } = await scope.examinePageID( scope, 'none to match' );
    • if ( scope.page_id !== id ) {
    • await scope.addToReport(scope, { type: page_id, value: ${ id }, });
    • scope.page_id = id;
    • }
    • const axe = new AxePuppeteer(scope.page);
    • axe.options({
    • runOnly: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"],
    • resultTypes: ['violations', 'incomplete']
    • });
    • let axe_result = await axe.analyze();
    • axeresult.pageid = scope.page_id;
    • axeresult.passesids = axeresult.passes.map(passobj => pass_obj.id);
    • axeresult.inapplicableids = axeresult.inapplicable.map(inappobj => inapp_obj.id);
    • axe_result.passes = [];
    • axe_result.inapplicable = [];
      • let axe_filename = null;
    • const passed = axe_result.violations.length == 0;
    • if (!passed) { ++ // TODO: Add timestamp to filename
    • axe_filename = await scope.getSafeScenarioFilename( scope, {prefix: aXe_failure_${ scope.page_id }}) + '.json';
  • fs.writeFileSync( axefilename, JSON.stringify( axeresult, null, 2 )); ++ fs.writeFileSync( ${ scope.paths.scenario }/${ axe_filename }, JSON.stringify( axe_result, null, 2 ));

    • let msg = Found potential accessibility issues on the ${ scope.page_id } screen. Details in ${ axe_filename }.;
    • await scope.addToReport( scope, {
    • type: error,
    • value: msg
    • });
    • } else {
    • await scope.addToReport(scope, { type: info, value: Accessibility on ${ scope.page_id } passed!})
    • }
    • return {
    • passed: axe_result.violations.length == 0,
    • axefilename: axefilename
    • };
    • },
    • tapElementBySelector: async function ( scope, selector, waitForTimeout ) { let elem = await scope.page.$(${selector}); let error_msg = Couldn't find "${selector}" on the page, is there a typo?; diff --cc lib/steps.js index 3a9a326,c59032e..0000000 --- a/lib/steps.js +++ b/lib/steps.js @@@ -18,9 -18,8 +18,10 @@@ const { v4: uuidv4 } = require('uuid')

      // Ours const scope = require('./scope');

    • const log = require('./utils/log'); const sessionvars = require('./utils/sessionvars'); +const makeartifactsfolder = require('./utils/makeartifactsfolder' ); + /** Of Note:

      • We're using **= because sometimes da text has funny characters in it that are hard to anticipate **/ @@@ -92,13 -77,9 +94,15 @@@ Before(async (scenario) => scope.scenarioid = uuidv4(); scope.expectedstatus = null; scope.expectedinreport = null; ++ console.log(1);

        await scope.addReportHeading(scope, {scenario}); scope.base_filename = await scope.getSafeScenarioBaseFilename(scope, {scenario});

  • let date = await scope.dateforfilename();
  • scope.paths.scenario = ${ scope.paths.artifacts }/${ scope.base_filename }-${ date };
  • scope.paths.scenario_report = ${ scope.paths.scenario }/report.txt;
  • fs.mkdirSync( scope.paths.scenario ); ++ console.log(2);

    // Downloads scope.downloadComplete = false; @@@ -107,8 -88,10 +111,12 @@@ scope.device = 'pc'; scope.activate = clickwith[ scope.device ]; scope.disableerror_screenshot = false; ++ console.log(3);

    scope.page_id = null;

    • scope.checkallfor_a11y = false;
    • scope.passedallfor_a11y = true; ++ console.log(4);

      // Reset default timeout scope.timeout = 30 ** 1000; diff --cc tests/features/observationsteps.feature index 5c5646f,d09cd3f..0000000 --- a/tests/features/observationsteps.feature +++ b/tests/features/observationsteps.feature @@@ -123,7 -123,7 +123,7 @@@ Scenario: I get the page's JSO Given I start the interview at "alltests" Then I get the page's JSON variables and values

    • @fast @o9 @screenshot -@fast @o11 ++@fast @o11 @screenshot Scenario: I take a screenshot Given I start the interview at "all_tests" Then I take a screenshot diff --git a/lib/utils/log.js b/lib/utils/log.js index ee9960e..3ec329c 100644 --- a/lib/utils/log.js +++ b/lib/utils/log.js @@ -51,8 +51,24 @@ log.debug = function ({ type='', pre='', data='', post='' }) { } };

-log.addtodebuglog = function(value) { - fs.appendFileSync(log.debuglogfile, value); +log.addtodebuglog = function(value, pathname) { + /* Try to add value to file at optional path. On failure, try to add to file at a default + * directory. If that doesn't exist, make that default directory and then put log there. + * + * This complexity is mostly for unit tests, which don't otherwise go through the artifact + * folder creation process. */ + try { + fs.appendFileSync(pathname, value); + } catch (err) { + try { + fs.appendFileSync(${ log.fallback_debug_dir }/${ log.debug_log_file }, value); + } catch (err) { + console.log( err ); + fs.mkdirSync( log.fallbackdebugdir ); + fs.appendFileSync(${ log.fallback_debug_dir }/${ log.debug_log_file }, value); + } + } };

log.debuglogfile = 'debuglog.txt' +log.fallbackdebug_dir = _alkiln_test-misc_artifacts;```

Joe A
2022-06-10 09:28:33

*Thread Reply:* do you have a link to github?

plocket
2022-06-10 09:30:20

*Thread Reply:* I can commit it to a different branch and push it there. That may take a bit.

Joe A
2022-06-10 09:30:39

*Thread Reply:* You don’t need to do that

Joe A
2022-06-10 09:30:58

*Thread Reply:* I’m just going to look at what changed from when it was working to now and debug it that way.

plocket
2022-06-10 09:32:15

*Thread Reply:* This is the branch I’m merging into it: https://github.com/SuffolkLITLab/ALKiln/tree/releases/v4

Joe A
2022-06-10 09:32:55

*Thread Reply:* Can you open a pull request between the two branches, so I can see the diff?

plocket
2022-06-10 09:33:54

*Thread Reply:* https://github.com/SuffolkLITLab/ALKiln/pull/567

Joe A
2022-06-10 09:41:46

*Thread Reply:* Nothing super obvious jumps out. there’s a lot going on in the before, hard to tell what could possibly be causing it

plocket
2022-06-10 11:15:43

*Thread Reply:* Thanks for taking a look

Milena May
2022-06-22 10:46:56

@Milena May has left the channel

plocket
2022-06-27 17:26:52

Is it possible to repeat a Scenario only on a specific kind of failure? [Not just a specific kind of tag.]

plocket
2022-07-11 06:11:02

*Thread Reply:* Or flag a specific Scenario for retesting [while that scenario is being run]?

David Goss
2022-07-11 06:12:59

*Thread Reply:* Not at the moment. Only tags can influence whether retry kicks in.

plocket
2022-07-11 06:13:41

*Thread Reply:* Can I add a tag while the Scenario is running?

David Goss
2022-07-11 06:13:56

*Thread Reply:* No, those only come from the feature files.

✅ plocket
Tom
2022-07-04 08:45:40

@Tom has joined the channel

Tom
2022-07-04 08:45:59

Hey there, since updating from cucumber-js version 7 -> 8, I've been encountering an error whereby the duration values in the cucumber_report.json are decimal values which is causing errors in my AWS Stack, is this a configurable setting where I can prevent decimal values? I can provide screenshots shortly.

Aurélien Reeves
2022-07-04 08:56:28

*Thread Reply:* Hi Tom,

This is a known thing. It has been discussed a few weeks ago here: https://cucumberbdd.slack.com/archives/C6QJ6N695/p1651483291178619

As you can see, I have submitted an issue to AWS, but it seems they do not care about it 😢

From our side, right now we have no plan to revert our changes

However if someone submit a PR to add an option that would disable the performance counter on demand, I guess that would be accepted

Jim Trenowden (https://cucumberbdd.slack.com/team/U01HES3NT2R)
Aurélien Reeves
2022-07-04 08:57:37

*Thread Reply:* do you think you could open a feature request suggesting that here: github.com/cucumber/cucumber-js/issues?

Tom
2022-07-04 09:02:05

*Thread Reply:* Hey Aurélien, thank you for the quick reply.

To confirm, you want me to create a feature request on the cucumber github to add a config to disable the duration counter?

I'm happy to do that I just want to be sure 😄

Tom
2022-07-04 09:07:20

*Thread Reply:* https://github.com/cucumber/cucumber-js/issues/2086

Please see this and let me know if it's satisfactory

Jim Trenowden
2022-07-05 01:26:44

*Thread Reply:* I forgot to mention, I actually raised this directly with AWS support a few days ago after not hearing anything on the GitHub issue. This was the reply:

```Hello,

Thank you for contacting AWS Premium Support. My name is Kieran and I will be assisting you today!

I understand on upgrading Cucumber-js to version 8.0, CodeBuild began failing with the following message:

—— Error in UPLOAD_ARTIFACTS phase: [system: [error processing report: [/codebuild/output/src381885655/src/reports/system/cucumber.json: json: cannot unmarshal number 253118.99999999997 into Go struct field Result.elements.steps.result.duration of type time.Duration]]] ——

I have researched the 'cannot unmarshal number' message on my side and can see that this is a known Golang issue which you can read more about here [1]. The error here describes the JSON duration being unable to be marshalled to the 'time.Duration' type.

As this is a Golang issue and not a CodeBuild issue, unfortunately, this falls outside of AWS' Scope of Support [2].

However, I have looked further into the issue. Please see the blog post [3] discussing marshalling methods for Go. It includes example code for handling of numeric or string representations.

I hope our chat today helped. If you have further concerns or queries, please do not hesitate to reach out. I am always happy to help!

Have a great day!``` I’m going to push back, as it’s their json parser that has the issue

👍 Tom
Aurélien Reeves
2022-07-05 01:50:53

*Thread Reply:* Thanks @Jim Trenowden 👏

David Goss
2022-07-05 08:12:47

*Thread Reply:* @Jim Trenowden do you have a link or case # for that case you raised with AWS? I might have a way to get it in front of the right people.

David Goss
2022-07-05 10:27:27

*Thread Reply:* (Feel free to DM if preferred)

Jim Trenowden
2022-07-06 01:59:26

*Thread Reply:* Sure, it’s case 10309560831

David Goss
2022-07-06 02:01:20

*Thread Reply:* Great, thanks! Let me see what I can do.

🙌 Jim Trenowden
Tom
2022-07-14 08:21:40

*Thread Reply:* Hi @David Goss did you have any luck with escalating this to the right people at AWS?

David Goss
2022-07-14 09:10:35

*Thread Reply:* Yes, somewhat. For now they’re going to call out 7.x as their highest supported cucumber-js version, and a fix for the unmarshalling error is on their backlog - no timescale though

Tom
2022-07-15 02:00:53

*Thread Reply:* Ace, thank you. Is the plan currently to implement the opt-out option you spoke about before or wait for AWS to address the error on their end?

David Goss
2022-07-15 02:02:15

*Thread Reply:* To be honest I’m minded to just change the JSON formatter to Math.floor those timestamps rather than make an option. I think this was a regression/oversight on our part (core team) that we should correct. Hopefully AWS will also make their code more flexible and then the affected versions will work for them as well.

🙌 Jim Trenowden, Tom
Tom
2022-07-15 02:03:33

*Thread Reply:* That's awesome, do you anticipate a timeframe for this? Appreciate there's a lot you folks do just so I can take it back to my boss 😄

slackbot
2022-07-15 02:03:33

*Thread Reply:* Salutations Earthling! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

David Goss
2022-07-28 05:36:38

*Thread Reply:* https://github.com/cucumber/cucumber-js/pull/2094 - hoping to get this in and released in the next couple of days

Comments
1
👏 Jim Trenowden
Jim Trenowden
2022-07-29 00:44:58

*Thread Reply:* Amazing, thank you @David Goss!

David Goss
2022-07-29 00:45:40

*Thread Reply:* No worries! Let me know if that makes your issues on CodeBuild go away. The team at AWS kindly added this to their backlog, but if it’s fixed from our side I can tell them not to worry.

Jim Trenowden
2022-07-29 00:46:24

*Thread Reply:* I’ll try updating our project now, I’ll let you know what happens

👌 David Goss
Eliav Ran
2022-07-04 23:11:22

in my project i have step that create my app and it is dependent on world parameters in order to inject environment variables that is forcing me to use Before instead of before all is there a way to inject the env var into the process in another way right now i do it in this order and the initialize my app

David Goss
2022-07-04 23:58:33

*Thread Reply:* This overlaps with https://github.com/cucumber/cucumber-js/issues/1393 - there’s a change being worked on now where BeforeAll would have access to world parameters.

Labels
⚡ enhancement
Comments
13
David Goss
2022-07-04 23:58:53

*Thread Reply:* In the meantime probably the least worst thing to do is to use actual environment variables I.e. set them outside of the cucumber process

sergio moran
2022-07-05 07:53:01

@sergio moran has joined the channel

Flare
2022-07-11 12:36:35

@Flare has joined the channel

Manav Misra
2022-07-11 14:34:50

@Manav Misra has joined the channel

luke
2022-07-13 06:19:56

suggestion from product owner on my team. Display all types of status in html report (We should know them).

😕 Manav Misra
UoB software developer
2022-07-21 09:28:21

@UoB software developer has joined the channel

UoB software developer
2022-07-21 09:31:22

Hi folk,

I'm a newbie starting out on my cucumber-js journey and I was wondering if there were any examples of a configuration file that could be used to run tests against multiple browsers. I think that I need to setup profiles then somehow pass the name of each browser to the CLI?

David Goss
2022-07-21 09:39:53

*Thread Reply:* Welcome @UoB software developer 👋

You’re right that profiles is a good tool for this kind of thing. You might have your configuration file be like: { "chrome": { "worldParameters": {"browser": "chrome"} }, "firefox": { "worldParameters": {"browser": "firefox"} } } And then pick that up in a custom World class that spins up your browser instance:

if (this.parameters.browser === 'chrome') { // spin up chrome } // etc

UoB software developer
2022-07-22 01:01:06

*Thread Reply:* @David Goss Thanks for the response. Great tip. I'll try this!

👍 David Goss
Amber Brocato
2022-07-26 15:58:01

@Amber Brocato has joined the channel

Ryan
2022-08-03 01:31:07

@Ryan has joined the channel

Michael Morris
2022-08-03 13:53:24

@Michael Morris has joined the channel

Michael Morris
2022-08-03 13:53:43

I'm stuck getting Typescript to work using Babel to control transpiling.

Michael Morris
2022-08-03 13:54:50

*Thread Reply:* babel.config.json { "presets": ["@babel/preset-env", "@babel/preset-typescript"] }

Michael Morris
2022-08-03 13:55:06

*Thread Reply:* cucumber.json { "default": { "publishQuiet": true, "requireModule": [ "@babel/register" ], "require": [ "steps/****/**.ts" ] } }

Michael Morris
2022-08-03 13:55:29

*Thread Reply:* package.json { "name": "@ucx/cucumber-screenplay", "version": "1.0.0-beta.3", "description": "Cucumber Screenplay support libraries", "main": "dist/index.js", "type": "module",

Michael Morris
2022-08-03 13:56:02

*Thread Reply:* tsconfig.json { "files": ["src/index.ts"], "compilerOptions": { "target": "esnext", "module": "commonjs", "moduleResolution": "node", "declaration": true, "outDir": "dist", "esModuleInterop": true, "strict": true, "typeRoots": ["node_modules/@types", "./src"], "allowSyntheticDefaultImports": true, "resolveJsonModule": true }, "include": ["src/****/**"], "exclude": ["src/****/**.spec**"],

Michael Morris
2022-08-03 13:56:09

*Thread Reply:* I'm stumped.

David Goss
2022-08-03 22:45:12

*Thread Reply:* Do you have details of what goes wrong e.g. stack traces?

David Goss
2022-08-03 22:46:20

*Thread Reply:* At first glance I notice you’re using requireModule and require in your config and your module format in tsconfig is commonjs, but then you have type: "module" in the package.json - this could be an issue but not totally sure.

Michael Morris
2022-08-04 08:17:41

*Thread Reply:* Possibly. I'm just getting more confused.

Michael Morris
2022-08-04 08:18:22

*Thread Reply:* Starting over (ignore the above, I've been editting). This is the script invocation in the package.json: "scripts": { "test": "cross-env NODE_OPTIONS=\"--loader ts-node\" cucumber-js",

Michael Morris
2022-08-04 08:18:53

*Thread Reply:* Currently using a cucumber.cjs to configure cuke with this: module.exports = { default: { publishQuiet: true, requireModule: [ "ts-node/register" ], require: [ "steps/****/**.ts" ] } }

Michael Morris
2022-08-04 08:19:20

*Thread Reply:* tsconfig.json: "compilerOptions": { "target": "esnext", "module": "esnext", "moduleResolution": "node", "declaration": true, "outDir": "dist", "esModuleInterop": true, "strict": true, "typeRoots": ["node_modules/@types", "./src"], "allowSyntheticDefaultImports": true, "resolveJsonModule": true },

Michael Morris
2022-08-04 08:19:57

*Thread Reply:* And when I try to run: ```PS C:\Users\tendo\Projects\ucx\mfa\tests\cucumber-screenplay> npm test

> @ucx/cucumber-screenplay@1.0.0-beta.3 test > cross-env NODE_OPTIONS="--loader ts-node" cucumber-js

(node:24552) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) Error [ERRREQUIREESM]: Must use import to load ES Module: C:\Users\tendo\Projects\ucx\mfa\tests\cucumber-screenplay\steps\init.ts```

Michael Morris
2022-08-04 09:49:41

Ok, I'm down to this - I thought the ESM bugbear was fixed? Error [ERRREQUIREESM]: require() of ES Module C:\Users\tendo\Projects\ucx\mfa\tests\cucumber-screenplay\test-build\index.js from C:\Users\tendo\Projects\ucx\mfa\tests\cucumber-screenplay\node_modules\@cucumber\cucumber\lib\api\support.js not supported.

Michael Morris
2022-08-04 10:21:51

K, got it. I overlooked that there's now a difference between --require and --import

Michael Morris
2022-08-04 10:22:39

When I have some time I'll revisit the docs to make this more obvious somehow.

Michael Morris
2022-08-04 10:32:57

K, looking at the docs, I did flat out overlook this so it isn't the fault of the authors of the doc file. I'll move this to committers-js for improving this.

Michael Morris
2022-08-04 11:37:54

What is the datatype of the scenario variable passed into a BeforeHook (and several others)?

Michael Morris
2022-08-04 11:48:27

What is the type here? Before(async function (scenario:???) {})

Michael Morris
2022-08-04 11:54:47

Found ITestCaseHookParameter - is that right (seems right).

Manav Misra
2022-08-07 13:57:48

I got these customer parameter types set up so that I can specify any name for listener and shouter. Great. What I fail to understand is this: If transform automatically creates a new Person type, where is that actually being used? I still need to create my own in the step definitions so that it's associated with this. So, what is the benefit of the return from the transform fxn.?

Manav Misra
2022-08-07 14:07:18

*Thread Reply:* ```import { defineParameterType } from "@cucumber/cucumber";

defineParameterType({ name: "listener", regexp: /[a-zA-Z]+/, });

defineParameterType({ name: "shouter", regexp: /[a-zA-Z]+/, });`` Works same.transform` not doing anything here.

Manav Misra
2022-08-07 14:10:29

*Thread Reply:* ```import { defineParameterType } from "@cucumber/cucumber";

const names = ["listener", "shouter"];

names.forEach((name) => { defineParameterType({ name, // name of the parameter type regexp: /[a-zA-Z]+/, // regular expression to match the parameter }); });``` More DRY. 🤓

matt-SmartBear
2022-08-10 08:41:24

*Thread Reply:* You can access this from the transform function too, so you can set this.listener or this,shouter in the parameter type, if you want to.

matt-SmartBear
2022-08-10 08:42:05

*Thread Reply:* The idea of the transform function is to turn the string from the regexp capture into something more meaningful and useful in your domain,

👍 Manav Misra
Manav Misra
2022-08-10 09:04:31

*Thread Reply:* Instead of just {word} or {int}.

Michael Morris
2022-08-16 07:40:54

I think I've bumped into a serious problem. This config doesn't work: module.exports = { default: { publishQuiet: true, requireModule: ['@babel/register'], import: [ "steps/****/**.ts" ] } }

Michael Morris
2022-08-16 07:42:31

*Thread Reply:* If I require instead of import I get a different error.

Michael Morris
2022-08-16 07:43:08

*Thread Reply:* The only way I've been able to get this to work is to compile the cucumber steps to the file system manually instead of JIT.

Michael Morris
2022-08-16 07:43:45

*Thread Reply:* The problem seems to be there is no importModule directive that parallels requireModule

Manav Misra
2022-08-16 08:52:08

*Thread Reply:* I m using Babel and using import without issue. LMK and I can share some snippets. I m using Jest with 🥒

matt-SmartBear
2022-08-16 13:12:52

*Thread Reply:* Maybe we could work towards a new example in https://github.com/cucumber-examples/cucumber-js-examples ?

Stars
7
Language
Makefile
👍 Manav Misra
matt-SmartBear
2022-08-16 13:14:04

*Thread Reply:* This example uses ts-node, perhaps you two could put together a working example for typescript and babel?

https://github.com/cucumber-examples/cucumber-js-examples/tree/main/examples/typescript-node

Manav Misra
2022-08-16 13:56:04

*Thread Reply:* Yeah. Possibly. M not using TS, but I will post back with something.

David Goss
2022-08-18 07:00:11

*Thread Reply:* > The problem seems to be there is no importModule directive that parallels requireModule https://github.com/cucumber/cucumber-js/blob/main/docs/esm.md#transpiling

Michael Morris
2022-08-18 07:01:48

*Thread Reply:* I've been quiet cause I'm still fighting with this. When I have a solution I'll look to helping communicate it.

Michael Morris
2022-08-18 07:02:27

*Thread Reply:* I'm inexperienced with typescript, so I don't know how much of my problem is that inexperience.

Manav Misra
2022-08-18 07:45:41

*Thread Reply:* Well, I might suggest leaving TS alone and just focus on the JS part first. Certainly, TS is important, but maybe only pursue one at a time for learning.

Michael Morris
2022-08-18 07:46:42

*Thread Reply:* I've already built a testing framework up in just JS and maintained it for nearly 2 years now. I want to incorporate TS because we are migrating the rest of the codebase to TS

👍 Manav Misra
Manav Misra
2022-08-26 06:08:46

*Thread Reply:* @matt-SmartBear Still looking into getting the example stuff together. It would be after Labor Day (about 2 weeks or so) before I get to it.

matt-SmartBear
2022-09-06 14:56:38

*Thread Reply:* Nice one @Manav Misra - I've been on vacation until now myself. If you want to pair on it, hit me up at calendly.com/mattwynne/

Manav Misra
2022-09-06 16:37:10

*Thread Reply:* Will do. Thanks.

Manav Misra
2022-10-03 20:19:06

*Thread Reply:* Crazy busy - looking for new position and such...but being as this is Hacktoberfest, I will carve 🎃 out some time for this. 🤓

matt-SmartBear
2022-10-04 08:53:34

*Thread Reply:* 🙂

LayMui
2022-08-23 21:46:03

Hi, I have issue with using cucumber expression. I get the step defn not defined. here is the step definition https://github.com/LayMui/RNLogin/blob/master/tests/src/step-definitions/azureADAuth.steps.ts#L10 and the issue seen https://github.com/LayMui/RNLogin/blob/master/Issue.md thanks

LayMui
2022-08-26 00:26:11

*Thread Reply:* thanks this is fixed with {word}. I miss out this

👍 David Goss
Alexander E. Fischer
2022-09-01 00:49:41

@Alexander E. Fischer has joined the channel

David Goss
2022-09-03 03:25:35

*Thread Reply:* 👋 the readme should get you to a simple hello world that runs and passes https://github.com/cucumber/cucumber-js#readme

Is your question more around how to automate against the React app? Are you thinking of testing at the component level (eg with testing-library), or working it from the outside with a browser driver?

Alexander E. Fischer
2022-09-03 04:54:08

*Thread Reply:* Thanks I'll have a look.

Alexander E. Fischer
2022-09-03 04:54:33

*Thread Reply:* Mostly I'm looking for a starting point for outside in BDD style in a create-react-app

David Goss
2022-09-03 05:03:18

*Thread Reply:* Okay so here's a starter you might find useful https://github.com/davidjgoss/cucumber-puppeteer-typescript-starter

Stars
5
Language
TypeScript
David Goss
2022-09-03 05:04:02

*Thread Reply:* There are some more current ones from others that use playwright not puppeteer, which I think is an improvement.

Alexander E. Fischer
2022-09-03 05:08:25

*Thread Reply:* but it is using Gherkin?

Alexander E. Fischer
2022-09-03 05:08:40

*Thread Reply:* i would prefer Gherkin over native JS stuff

Alexander E. Fischer
2022-09-03 05:09:58

*Thread Reply:* ok, the example has Gherkin files. nice

Alexander E. Fischer
2022-09-03 05:10:23

*Thread Reply:* wouldn't it be possible to build a template for create-react-app?

Alexander E. Fischer
2022-09-03 05:10:31

*Thread Reply:* did noone do that?

Brian Hnat
2022-09-01 05:12:02

@Brian Hnat has joined the channel

Uzeyir Abdullayev
2022-09-01 11:34:48

@Uzeyir Abdullayev has joined the channel

David Oberg
2022-09-06 10:35:53

@David Oberg has joined the channel

Chandrika
2022-09-08 02:34:49

@Chandrika has joined the channel

Chandrika
2022-09-08 02:39:58

Hello, I am a tester writing cucumber js script … I am encountering an error : function timed out , ensure promise resolves within 5000 ms How do I resolve it?? Though The script executes next steps even after the above error

David Goss
2022-09-08 02:49:39

*Thread Reply:* See https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/timeouts.md

Chandrika
2022-09-12 04:11:03

*Thread Reply:* Thanks

Tim Yao
2022-09-09 23:13:15

Hi, in parallel mode, afterAll hook will be called in each worker process. Do we have a way to run something after all workers' processes are completed? I was having my HTML reporter generate task in an afterAll before I implemented the parallel. It should be only called once and need to wait for all workers to be completed.

David Goss
2022-09-10 01:53:19

*Thread Reply:* We have an issue for this with an agreed way forward in https://github.com/cucumber/cucumber-js/issues/1153#issuecomment-657899146 but it hasn’t been implemented yet. There’s some other work in flight relating to test run hooks, after that’s done I’ll probably pick this up next (but if you feel like giving it a go in the meantime, go ahead!). There are some workarounds mentioned by other users in the ticket which may or may not be useful.

Tim Yao
2022-09-10 20:12:08

*Thread Reply:* Hi @David Goss that's great to see some work has been done already. Not sure what I can help with. I may need a clear guide. Thanks.

matt-SmartBear
2022-09-13 21:25:21

*Thread Reply:* @Tim Yao if you want to pair, https://calendly.com/mattwynne and we can figure it out together

Calendly
Tim Yao
2022-09-13 21:34:42

*Thread Reply:* Thanks @matt-SmartBear ! looks like the timezone for us to meet is quite hard

Tim Yao
2022-09-13 21:35:55

*Thread Reply:* Is it possible for find a time slot works in Melbourne?

Tim Yao
2022-09-13 21:37:35

*Thread Reply:* probably like Melbourne afternoon, seems we are both working.

matt-SmartBear
2022-09-13 21:40:14

*Thread Reply:* I'm on PST, so my guess is it's more your morning / my afternoon?

Tim Yao
2022-09-13 21:42:02

*Thread Reply:* yes, looks like. Your time is 9pm now?

Tim Yao
2022-09-13 21:42:26

*Thread Reply:* It's 2:40pm in my place

matt-SmartBear
2022-09-13 21:56:19

*Thread Reply:* yeah, well nearly 10pm now!

Vidhya
2023-01-12 20:48:24

*Thread Reply:* I am also facing the same issue, I want to run some tests in before all and after all in one thread in parallel, kind of one time setup in suite level, Can anyone help me to sort this issue.. Thanks..

Avinash Poptani
2022-09-13 10:39:53

@Avinash Poptani has joined the channel

Chandrika
2022-09-22 04:59:10

Hello , I have an issue with using Before all statement in multiple steps_definition file. Which is calling every BeforeAll statement when I run one specific scenario ( that will call only one cucumber step definition having Before All) How do I fix this issue?

Am I not suppose to use multiple time beforeAll in different step-definition files.

David Goss
2022-09-22 10:38:40

*Thread Reply:* What are you trying to achieve?

BeforeAll hooks will run at the start of a test run always. It doesn't matter which file they are defined in and/or if any of the running steps are in the same file.

👍 Chandrika
David Goss
2022-09-22 10:39:13

*Thread Reply:* It sounds like you might want a Before hook which can be targeted at specific scenarios via tags

Chandrika
2022-09-22 11:39:39

*Thread Reply:* I have two feature file and different step definitions according to feature I'm running. Now the issue is in each step definition I have defined the before all tag. Unfortunately a weird issue is occurring where it runs the before all , of all the step definition.

When I commented out one before all hook I don't see the above mentioned issue.

David Goss
2022-09-22 12:19:55

*Thread Reply:* Like I said, BeforeAll hooks aren't tied to steps at all. They always run regardless of which scenarios you've filtered to.

Chandrika
2022-09-22 22:22:03

*Thread Reply:* Thanks will try with Before hooks

Chandrika
2022-09-23 00:38:53

*Thread Reply:* Seems same issue with before hook

Cat
2022-09-30 16:37:28

*Thread Reply:* Can you share a snippet?

Chandrika
2022-10-10 03:51:31

*Thread Reply:* This issue got resolved after I used tagged hooks. Thank you all

luke
2022-09-22 06:55:30

you want tagged hooks it sounds like?

Chandrika
2022-09-23 00:40:29

*Thread Reply:* Do you mean each scenario annotated?? If yes , no I'm not looking for that yet.. The scenario is I have multiple feature file… running one feature file calls all before hooks from different feature file

Chandrika
2022-09-23 01:20:23

*Thread Reply:* Seems your answer will solve my question… as I read some issue and solution suggested was to “ if I want to run the hook only for certain feature, need to use conditional hook”

Chandrika
2022-09-23 01:20:46

*Thread Reply:* Please give some examples as I don't understand how to tackle this

luke
2022-09-23 01:20:50

*Thread Reply:* yes, that's the purpose of hooks. all hooks are added

luke
2022-09-23 01:21:00

*Thread Reply:* ```Before do puts 'hi' end

Before do puts 'yo' end```

luke
2022-09-23 01:21:14

*Thread Reply:* this is the same as

luke
2022-09-23 01:21:21

*Thread Reply:* Before do puts 'hi' puts 'yo' end

Yaozhi Lu
2022-09-24 08:49:03

@Yaozhi Lu has joined the channel

SantoshK
2022-10-07 10:31:27

8.6.0

❓ David Goss
Adventurekateer
2022-10-07 16:11:43

@Adventurekateer has joined the channel

Chandrika
2022-10-12 00:04:21

Hello ,

I wanted to know how can I assert for ‘elementNotExisiting’ or I want to make sure that element is not present on UI

Luděk Nový
2022-10-13 00:11:04

*Thread Reply:* Hello, your question has actually nothing to do with cucumber itself. The answer depends on your assertion library....

Chandrika
2022-10-13 07:08:28

*Thread Reply:* Hello , I do understand it’s about assertion and I don’t know how to assert for the exceptions. Can you help me on this?

Luděk Nový
2022-10-13 23:32:31

*Thread Reply:* Chandrika, I cannot help you as I dont have any detail information about what assertion library you use. Check the docs of your asserting library and of the tool you use for instructing the browser.

Chandrika
2022-10-13 23:33:09

*Thread Reply:* I’m using chai libraries

Luděk Nový
2022-10-13 23:34:13

*Thread Reply:* Good, so look for the answer here: https://www.chaijs.com/api/

Chandrika
2022-10-13 07:10:09

Hello , I did try on driver.actions().doubleClick(webElement)

But the above code doesnot do the required action (I.e. Double click on webElement) .

And basically webElement is a data in data grid or table .

TIA

Acs
2022-10-19 01:02:40

@Acs has joined the channel

Acs
2022-10-19 02:44:56

Hi Team How to write the parameters for runCucumber method? Is there any samples available please share @David Goss

matt-SmartBear
2022-10-26 09:55:07

*Thread Reply:* Check out https://github.com/cucumber/cucumber-js/blob/d46c797aba67d36b5f446d202667d9d554b81462/docs/javascript_api.md

Acs
2022-10-19 05:01:03

Anybody integrated cucumber with aws lambda?

Adam Urban
2022-11-02 05:51:34

@Adam Urban has joined the channel

Elant Testing
2022-11-24 12:18:36

@Elant Testing has joined the channel

hajime
2022-11-24 12:40:02

@hajime has joined the channel

hajime
2022-11-24 12:40:32

Hi, I'm trying to run cucumber-js with Typescript. I followed the documentation, but I got an error "Cannot use import statement outside a module". It seems like babel isn't working correctly but I couldn't figure out how to fix it. Could you help me? A minimum reproducible example is here: https://github.com/Hajime-Suzuki/cucumber-ts-issue Thank you in advance! 🙇

Language
TypeScript
Last updated
a day ago
👀 David Goss
✅ David Goss
David Goss
2022-11-25 01:32:19

*Thread Reply:* Looks like babel needs a bit of extra config to work with ts files, I raised https://github.com/Hajime-Suzuki/cucumber-ts-issue/pull/1 which makes it work.

hajime
2022-11-25 23:08:39

*Thread Reply:* Thank you so much David! 🙏

Mustafa Erdogdu
2022-11-30 15:57:14

@Mustafa Erdogdu has joined the channel

Cherif Bouchelaghem
2022-12-16 18:43:38

Hi all, in Behat PHP we can use same scenarios to drive multiple contexts like domain model, application service and even API or e2e tests, however, I'm unable to find how to achieve this using cucumberjs, any help will be appreciated!

Cherif Bouchelaghem
2022-12-16 19:16:47

*Thread Reply:* the solution that I found till now is to make a different configuration file for each layer/type of steps for example cucumber.domain.json for domain model and cucumber.acceptance.json for application services

David Goss
2022-12-17 00:08:30

*Thread Reply:* A single configuration file with profiles would probably work https://github.com/cucumber/cucumber-js/blob/main/docs/profiles.md

💯 Cherif Bouchelaghem
Cherif Bouchelaghem
2022-12-17 12:39:30

*Thread Reply:* checking out this, thank you @David Goss

Cherif Bouchelaghem
2022-12-17 12:59:24

*Thread Reply:* Worked like a charm, thank you again

👍 David Goss
hajime
2022-12-19 02:26:19

Hello, what is the best way to set up a fake timer per feature (if possible)? I would like to use a different timer in each file like below ```// steps/a.ts import FakeTimers from '@sinonjs/fake-timers'

let clock Before(() => { clock = FakeTimers.install({ now: new Date('2022-10-29T10:15:34') }) })

After(() => { clock.uninstall() })

Given('...') When('...') Then('...') // steps/b.ts

import FakeTimers from '@sinonjs/fake-timers'

let clock Before(() => { clock = FakeTimers.install({ now: new Date('2022-08-08T10:15:34') }) })

After(() => { clock.uninstall() })

Given('...') When('...') Then('...')`` However, when I run the tests I get an error message sayingCan't install fake timers twice on the same global object.` It seems like every step file is executed in parallel, but I wonder if there is any way to isolate them.

matt-SmartBear
2022-12-20 09:48:53

*Thread Reply:* Do you really need two separate clocks? I’m not sure this is possible from reading the Sinon docs, as that install method patches some global methods like setTimeout.

matt-SmartBear
2022-12-20 09:50:26

*Thread Reply:* Assuming you can share one clock, just use a single set of Before/After hooks and have them set/use this.clock

That will set the clock property on the “world” which is this in each of your steps.

matt-SmartBear
2022-12-20 09:52:07

*Thread Reply:* It might be better to put those hooks in a file like features/support/clock.js rather than a step file, though that’s up to you. Cucumber just loads all of those files and how you organize your code in them is your choice.

hajime
2022-12-20 23:23:37

*Thread Reply:* Thank you for your reply 😀 Let’s say I want to test 2 different scenarios where the date is in the past and future. When I use this.clock to set date for the 2 cases in the Before, are those dates isolated? I observed Before was called for each step definition file in parallel. I might see the future date in the test where I need the past date. I’m very new to cucumber, and I miss important concepts. But this is what I’m struggling with now

matt-SmartBear
2022-12-22 20:52:17

*Thread Reply:* My understanding is that when Cucumber runs scenarios in parallel, they run in isolated processes so you won't get any clashes.

Can you give it a try and let us know how you get on?

hajime
2022-12-26 23:32:36

*Thread Reply:* Hi @matt-SmartBear, sorry my slow response. I tried to run my tests in parallel but this was not isolated 😞 Here is a reproduction of my issue. https://github.com/Hajime-Suzuki/cucumber-ts-issue

The documentation says BeforeAll and AfterAll are isolated. Maybe Before and After are not.

Language
TypeScript
Last updated
4 minutes ago
Chandrika
2022-12-21 04:20:00

Hello , Is there a way where I call stepdefinition implemented in other stepdefinition step. So I don’t have to write steps redundant when the purpose is already achieved in other stepdefinition.

Eliav Ran
2022-12-21 05:30:26

*Thread Reply:* you can move the logic to function and call the function from both steps

👍 Chandrika
➕ David Goss
👍:skin_tone_2: matt-SmartBear
Or Shauloff
2022-12-21 05:17:00

@Or Shauloff has joined the channel

Or Shauloff
2022-12-21 05:21:03

<#C6QJ6N695|help-cucumber-js> Hi everyone! I'm using cucumber js with node (v16.13.2) to test my application for a while. I have implemented a kafka consumer within kafka-js npm package, which is running in the background of the application (initialized in the app.ts). I built a step to wait asynchronously for the task of the consumer to finish, but it seems like it hangs the whole application, and only after getting to the step timeout definition - the consumer back to work. Is there anything I missed? Then('There are failed retries with kafka', async function (this: World) { while (!senderService.HasNumberOfFailedRequests(4)) { await setTimeoutAsync(3000); } });

Ronald
2023-01-04 00:19:14

@Ronald has joined the channel

Andrew
2023-01-04 14:46:26

@Andrew has joined the channel

Vidhya
2023-01-09 00:54:16

@Vidhya has joined the channel

Vidhya
2023-01-09 00:54:48

Hello ,

I want to do some one time data setup for my cucumber js test automation while the tests are running in parallel. so I am using setParallelCanassign function in my hooks class, but I get setParallelCanAssign is not a function error, Can anyone help me how the method should be created to avoid this error. pls note that I imported this function too <#C6QJ6N695|help-cucumber-js>

The Krishna
2023-01-09 02:54:04

@The Krishna has joined the channel

The Krishna
2023-01-09 02:57:26

I'm using cucumber-js, why all the remaining scenarios in are getting skipped after 1st scenario fails? I also tried --fail-fast false .

vidya
2023-01-16 02:43:57

Hello, Is it true that every time there is an upgrade to an APP or tool that we are automating needs the selenium scripts (using cucumber + JavaScript) to be updated with elements as well?

Even you need update scripts (node) when chrome updates?

Luděk Nový
2023-01-16 03:07:03

*Thread Reply:* Hello, if the selectors do change, then of course you need to update your tests. For this reason you should have good selectors strategy and collaborate with the devs on this.

vidya
2023-01-19 06:20:54

*Thread Reply:* Hi, Thank you for your response. We mostly use xpath as selector that includes classnames/ids which sometimes gets changes. Do you have any other strategy?

Luděk Nový
2023-01-19 06:40:40

*Thread Reply:* Xpath is usually not the best approach, have a look here :https://playwright.bootcss.com/python/docs/selectors#best-practices This should give you an idea

👍 vidya
Som
2023-01-19 02:10:11

@Som has joined the channel

sdeteng28
2023-01-19 11:17:04

@sdeteng28 has joined the channel

sdeteng28
2023-01-19 11:19:11

Hi All, I recently started working on cypress cucumber. How can I run several scenarios for various grids page in the same feature file? Three Hyperlinks [users, clients, and customers] are on one page. Each link when you click it loads a new grid of data with reports and date-picker components.

For example: I have Users link, clients link and customers link . Each tab(page) has reports and a datepicker calendar.

Report.feature contains the following scenarios scenario1: generate a recurring monthly report scenario2: generate a recurring weekly report scenario3: generate a one-time report

All of the scenarios should run for one grid initially, go to another grid, and finish three scenarios. I want to send user grid input, client grid input, and customer grid input in a single feature file.

Thanks in advance.

Vidhya
2023-01-20 18:33:11

Hi All, Is there any way to access world parameters in before all method? <#C6QJ6N695|help-cucumber-js>

Michael Morris
2023-01-23 13:54:55

*Thread Reply:* No, because when that hook eval's there's no world yet.

Michael Morris
2023-01-23 13:55:02

*Thread Reply:* What are you trying to do?

matt-SmartBear
2023-01-30 11:29:38

*Thread Reply:* We're working on it. See https://github.com/cucumber/cucumber-js/pull/1770

Labels
✅ accepted, ⚡ enhancement
Comments
13
👍 David Goss
Vidhya
2023-01-31 05:01:27

*Thread Reply:* Thanks for the update 👍

Eric Dantas
2023-01-20 19:06:31

@Eric Dantas has joined the channel

Vidhya
2023-01-31 05:03:42

Hi All, Cucumber js tagged after hooks are not executing in reverse order, Is there any way to control the tags in specific order, Please help <#C6QJ6N695|help-cucumber-js>

David Goss
2023-02-01 11:47:54

*Thread Reply:* The order that hooks are run in is based purely on the order they were defined in, and tags don't have any bearing on that. If the hooks are in multiple files, the order the files are loaded in will influence it. It's pretty common for people to group all their hooks together in one file to remove ambiguity around ordering.

luke
2023-01-31 06:45:35

the order of the code being read in will likely give you the greatest control here.

Miguel Aniceto
2023-02-02 02:06:26

@Miguel Aniceto has joined the channel

Miguel Aniceto
2023-02-02 02:08:50

~Hi everyone!~ ~I unfortunately did not realise this channel existed. If anyone could have a look at my question below, it would be much appreciated~ 🙏

https://cucumberbdd.slack.com/archives/C60TKS3SL/p1675330636636339

See the last comment on that message, thank you all!

Miguel Aniceto (https://cucumberbdd.slack.com/team/U04MV34BFDW)
Miguel Aniceto
2023-02-06 03:21:59

Hi there again 🙂 Need your help with a simple question, if possible!

I'll playing around with the paralell option in cucumber-js and to conditionally run the tests in parallel

I'm trying to access the CUCUMBER_WORKER_ID but as you can see in the example use-case (with 2 extra console.logs) ```// This prints the CUCUMBERWORKERID correctly: 0 | 1 | 2 | ... console.log("Outside -> Works", process.env.CUCUMBERWORKERID);

setParallelCanAssign((pickleInQuestion, inProgress) => { // Prints: undefined console.log("Inside -> Does not Work", process.env.CUCUMBERWORKERID);

return dontRunPicklesWithTag(pickleInQuestion, inProgress); });`` I'd like to look at the tag (e.g.WORKER1`) and depending on the WORKER_ID running, return false or true

However, given that inside setParallelCanAssign I'm getting undefined I can't do it atm, what would the best approach be?

Thanks in advance!

✅ David Goss
David Goss
2023-02-06 10:22:56

*Thread Reply:* The worker is env variable won’t be present because the custom assignment code is running on the coordinator not the worker.

Putting the code to one side, could you say more about what you’re trying to achieve here?

❤️ Miguel Aniceto
Miguel Aniceto
2023-02-06 11:16:50

*Thread Reply:* Hey @David Goss , Thank you for looking at this

My case is simple, I want to run certain scenarios per specific runners. Example

@Worker_1 Scenario …

@Worker_2 Scenario ...

I’ve made some changes to the source code which work for me (and internally I’ll simply patch-package) and I’ve opened a draft PR in the cucumber-js repo (I’ll update it more tomorrow)

This also covers the use-case that folks have been asking frequently in the cucumber-js issues of running features per worker

Looking forward to hearing your thoughts

David Goss
2023-02-07 12:28:05

*Thread Reply:* > My case is simple, I want to run certain scenarios per specific runners. Sorry as I know it can be annoying, but: why do you want to do that? What happens when you just use parallel normally?

You mentioned the “BeforeFeature” request, I wonder if it’s related to that.

❤️ Miguel Aniceto
Miguel Aniceto
2023-02-08 02:16:51

*Thread Reply:* Our use-case is a bit of a specific one, but I'm happy to share 🙂

Our web-app has a layer of authentication with a third party provider, once you login then you select different profiles. The active profile is stored per account (so you can't have 2 profiles in the same account active simultaneously).

Therefore, if I just run parallel what happens is that the tests fail since worker A is using Profile A, then worker B switches to Profile B and so worker A loose the profile mid-test and fails...

From what I saw in the github issues, getting access to the worker information was asked a few times and so I figured I'd make the PR (I'll need to fix the tests but the basic idea is there for discussion).

I wouldn't necessary just pass the worker information but rather all worker/world information but haven't done that yet!

Anyway, if this goes against the structure that you are looking for, that's fine and thank you for reading this/maintaining cucumber-js!

Ps: I have a feeling we are on different timezones, so apologies for the delay in responses!

matt-SmartBear
2023-02-08 10:42:06

*Thread Reply:* So your plan is to have each worker create its own profile?

matt-SmartBear
2023-02-08 10:43:20

*Thread Reply:* Where/when in your test suite does the login happen? Is it per scenario, or in some kind of global setup?

Miguel Aniceto
2023-02-09 01:07:23

*Thread Reply:* Heya @matt-SmartBear , It's done inside each feature file, in the background definition https://cucumber.io/docs/gherkin/reference/#background

Example, main-page.feature: ```@WORKER1 Feature: Main Background Given I login in as 'account1'

Scenario: Can see the profiles for choice ...``` Other github issues which I think match the same as I'm asking: https://github.com/cucumber/cucumber-js/issues/2222 https://github.com/cucumber/cucumber-js/issues/2217 https://github.com/cucumber/cucumber-js/issues/1044

If you don't mind me asking, is the parallel implementation in cucumber-js, parallelization or concurrency? I'm seeing that workers sometime idle while the others run, so I'm just making sure if it's my setup

Thank you for looking 🙂

matt-SmartBear
2023-02-09 12:20:57

*Thread Reply:* OK, so in your context the problem you want to solve is to not have any two scenarios running simultaneously with the same account profile?

Miguel Aniceto
2023-02-10 01:00:01

*Thread Reply:* Kinda, yes

I don't want to have two scenarios running the same account and different profiles (each account can choose from multiple profiles but can only have one active at a time)

E.g. Scenario 1 • Mat account ◦ Admin • Scenario 2 ◦ Regular user Once (2) runs, it takes over the profile and (1) fails

Could you please share if you know if the cucumber-js implementation is parallel or concurrent?

With the code changes I did to cucumber-js it does run as I want it but sometimes I can see some workers idling for a bit while the others run. Then they continue later

Hope that was clear and thank you for looking at this

matt-SmartBear
2023-02-10 08:38:42

*Thread Reply:* > parallel or concurrent I'm afraid I don't know the difference. Can you explain?

David Goss
2023-02-10 08:43:18

*Thread Reply:* I don’t think it translates neatly to either, but maybe it’s more like parallelism because the workers are independent threads. It’s possible for some of them to be idle if there are fewer scenarios still to be executed than available workers and/or if the setParallelCanAssign logic is constraining what can be assigned.

David Goss
2023-02-10 08:48:53

*Thread Reply:* Reading your explanation, I’m struggling to see why the current functionality couldn’t work for you. If users are the constrained resource, then tag the scenarios with those eg. @User-Matt and then use atMostOnePicklePerTag to ensure that user is only ever logged in from one place at a time. The fact that it might change workers between scenarios shouldn’t matter - you login at the start of each scenario, right? I think your focus on keeping it all on the same worker might be a little misplaced.

David Goss
2023-02-10 08:53:43

*Thread Reply:* You could even do a more custom function based on the combination of user- and profile-related tags if that would make it more efficient. But I don’t think you need to assert which worker.

Miguel Aniceto
2023-02-16 03:06:51

*Thread Reply:* That's fine, I'll update the PR soon to fix the tests and make it reviewable

You can then decide wether you want it or not, but it should help other folks who've asked for use-cases like this (or at least they can patch-package it if they want)

Thank you for looking at this!

Miguel Aniceto
2023-02-27 08:06:53

*Thread Reply:* I've updated the tests to the best of my knowledge and removed the draft

PR here

If you could share your thoughts there, that would be much appreciated

I can understand if this goes against the maintainers long-term plan, and if that's the case I don't mind at all if this gets closed.

Either way, thank you all for looking and sharing your thoughts 🙏

Comments
1
Paul Pham
2023-02-10 00:48:39

@Paul Pham has joined the channel

Eric Dantas
2023-02-11 10:11:14

Hello folks... any "sample" how to stuble/mock server responses?

Shubhangi Chaudhari
2023-02-11 15:31:21

@Shubhangi Chaudhari has joined the channel

Tim Yao
2023-02-14 02:40:58

Hi, is cucumber glue a thing in cucumber-js? I am not clear about what it is and how it works. I couldn't find docs in cucumber-js.

✅ David Goss
David Goss
2023-02-14 04:56:57

*Thread Reply:* “Glue” generally refers to the code that called by your step definitions that drives your automation. I think the term is used more in the JVM world. So JS has it but just doesn’t call it that - we refer more to “support code”

Tim Yao
2023-02-14 14:28:23

*Thread Reply:* Got it. Thanks @David Goss!

👍 David Goss
Michael Morris
2023-02-14 14:48:24

Is there a cypress cucumber library that works?

Michael Morris
2023-02-14 14:49:18

I'm trying one by badeball but it crashes when ESBuild is used for a preprocessor and locks up with webpack - so both his examples are bogus and I'm ready to look elsewhere.

luke
2023-02-15 01:02:23

architecturally there's no such thing as a cypress cucumber library. Cypress is designed to work completely isolated. The one badeball did was essentially just some extra modifications to the cypress code that distilled down the cucumber features into js code. Sadly that "route" is pretty much your only option.

Michael Morris
2023-02-15 08:33:29

Yeah, I'll pass on that. I'm going to go with straight Cucumber, and since the website is a portfolio I'll rewrite the tests in Cypress as a proof of domain knowledge. Probably do them a 3rd time in Jest. But at the moment I'm hitting the snag of getting Cucumber to cooperate with Typescript. I'm going over the docs on transpiling now.

Michael Morris
2023-02-15 09:22:12

How the hell do you use cucumber with typescript in a project that isn't a module?

Michael Morris
2023-02-15 09:22:40

And I can't simply plug type: "module" into the package.json - that breaks nextjs

Michael Morris
2023-02-15 09:24:09

Partially musing aloud here - I mean no offense to any of the devs or document writers. Once I figure this out I'll be adding my findings to a pull request for the transpling.md file in the docs folder.

Michael Morris
2023-02-15 09:27:11

ts-node doesn't seem to work no matter what I try.

Michael Morris
2023-02-15 10:09:36

K, breaking this down to the foundation with an empty repo running cucumber alone with ts-node. Feature: ```Feature: Addition

Scenario: Basic as it gets Given I have one When I add one Then I have two And corresponding step def import { Given, When, Then } from "@cucumber/cucumber"

let accumulate = 0;

Given("I have one", () => {accumulate = 1});

When("I add one", () => {accumulate += 1});

Then("I have two", () => { if (accumulate !== 2) throw "Computer can't add"; });``` Threading further responses (I'm writing this cause I'll need to come back to it to improve the documentation if possible).

Michael Morris
2023-02-15 10:11:32

*Thread Reply:* I suspect the problem is Nextjs insists that the project be compiled to ESM while at the same time not having the project marked as type="module"; and if I do add that to the package.json file Next.js blows up - so I need to figure out how to do this with Cucumber alone first then approach that hurdle.

Michael Morris
2023-02-15 10:25:40

*Thread Reply:* Ok, got it working with cucumber alone.

Michael Morris
2023-02-15 10:26:23

*Thread Reply:* And the docs are spot on. So now to bring in the tsconfig directives from nextjs and find the culprit

Michael Morris
2023-02-15 11:19:16

*Thread Reply:* Solution. NextJS' tsconfig.json.compilerOptions.module directive was set to "esnext" and Cucumber needs it to be "commonjs"

Michael Morris
2023-02-15 11:19:41

*Thread Reply:* The docs need to mention this somehow. I'll look into a phrasing and make a PR later today on it.

Bartosz Żołyński
2023-02-22 11:11:22

*Thread Reply:* Hi @Michael Morris. I am not fluent in JS, but with many years working around it I am trying to make sense out of it. Just by seeing your message, I hope to get some more understanding about it.

I wanted to use cucumber-js with React app by touching it on sort of a unit level, so not going through a webdriver, but really to write living documentation for business rules of a few complex components. So, I need **.tsx extension for steps, but when extension of file is changed, cucumber-js ignores that file entirely. I struggled to understand the whole thing about modules and transpilers, and one of JS developer wasn’t able to help me, so I decided to give jest-cucumber (https://github.com/bencompton/jest-cucumber) a try.

The result is that it works really great, especially with automatic step binding alternative and it’s incorporated in Jest tests, and testing library or any other tool can be used just out of the box as well, but reporting feature is broken so the point of having a widely accessible documentation is completely missed.

To be honest, I would love to have it all implemented just in cucumber-js but not sure if this is feasible, and did you make it working, or there is a need to request that feature?

This is the example where I cannot make it working for React components within features/support/steps.tsx file: ```import { Given, When, Then } from '@cucumber/cucumber'

...

When('flight summary component is rendered', function () { render( <Container> <FlightSummary flight={flightDetails} /> </Container> ); });`` Intsconfig.json, module is set toesnext`. I guess it should stay like that in my case, as the application already runs with that setting?

Thanks for reading it!

Bartosz Żołyński
2023-02-22 11:37:34

*Thread Reply:* P.S. I followed instructions in your PR, however, I wasn’t able to make it working for my case using a recipe for ts-node. Still, **.tsx file is being ignored so suggestion to add all steps is provided by cucumber-js.

Michael Morris
2023-03-20 14:39:32

*Thread Reply:* ts-node doesn't work with tsx files to my knowledge - you'll need to use Babel as the transpiler.

Elin Pendered
2023-02-15 10:53:13

@Elin Pendered has joined the channel

Vishnu Venugopal
2023-02-20 23:06:28

@Vishnu Venugopal has joined the channel

Elitsa Radeva
2023-02-21 07:42:23

@Elitsa Radeva has joined the channel

Elitsa Radeva
2023-02-21 07:42:55

Hi there,

I've been struggling a lot with this - I'm executing the tests using exec() function in nodeJS. It returns the process, which executes the tests. I want to be able to stop the execution of the tests, but killing the process is not stopping them. Could someone advise? 🙂

Thanks in advance!

David Goss
2023-02-24 12:27:43

*Thread Reply:* That does seem odd. I’ll see if I can reproduce but might have to come back to you for more information.

David Goss
2023-02-24 12:30:54

*Thread Reply:* Relatedly, since it seems like you’re triggering Cucumber from some code of your own, have you seen the JavaScript API? It doesn’t currently have a way to stop the test run mid-flight but we’re intending to add that soon. https://github.com/cucumber/cucumber-js/blob/main/docs/javascript_api.md

I’d be interested to hear about your use case for running Cucumber from code and wanting to stop the run mid-flight, if that’s something you’d be okay with sharing.

Elitsa Radeva
2023-02-28 00:14:34

*Thread Reply:* Hi David,

Thanks for your quick response! I'll spend some time and try out the API, I didn't know about it. 🙂 Regarding the stopping of the execution - it's more like I want to be able to stop the test suite execution upon a some signal, not the test itself (because there could be some unexpected behavior, if the test does not finish its work - database interactions, etc.) Since, every test should not be dependent on another, stopping the suite execution should not cause an issue. I'm running the cucumber through the code, because we developed a service, which is responsible for executing the test suites on some remote machines. For example, if the service receives a POST request with some test details, it's going to start the corresponding execution on specific machine. So I want to be able to stop the test suite execution upon a some request to my service.

Dorian Lopez
2023-02-22 07:56:29

@Dorian Lopez has joined the channel

Bartosz Żołyński
2023-02-22 10:53:01

@Bartosz Żołyński has joined the channel

Bartosz Żołyński
2023-02-23 01:10:15

Hello Cucumbers, I am looking for some clarification and I hope I can find some help over here regarding testing React components on - let’s call it - unit test level so without a webdriver. I have shared more details in this thread: https://cucumberbdd.slack.com/archives/C6QJ6N695/p1677093082738129?thread_ts=1676484576.091459&cid=C6QJ6N695

Bartosz Żołyński (https://cucumberbdd.slack.com/team/U04QW71QDRS)
Michael Morris
2023-03-20 08:39:29

*Thread Reply:* I'm sorry I'm so late in seeing this - I only check this board once every few weeks or when I'm actively developing. When you transpile modules you have to import the steps using a glob pattern that explicitly mentions their extension. I have typescript set to export as commonJS during testing so this is my cucumber config file for a NextJS site

module.exports = { default: { requireModule: ['ts-node/register'], require: ['features/steps/****/**.ts'], publishQuiet: true, exit: true } }

Michael Morris
2023-03-20 08:40:38

*Thread Reply:* You should be able to get it to work by changing the ts above to tsx and using the import directive if you exporting to a module. NextJS isn't happy having the package.json set to module mode for some reason so I had to go with require.

Michael Morris
2023-03-20 08:41:10

*Thread Reply:* Direct message me for follow-ups.

Bartosz Żołyński
2023-03-21 09:05:36

*Thread Reply:* Thanks @Michael Morris! I asked a JavaScript developer some time ago but I didn’t have time to check it out. Indeed, he suggested me to try the following:

> you might be able to use tsc to translate tsx to jsx and then use babel to translate jsx to JS. I will try to sort it out soon, so will get back to you in any case. Hope this can work :fingerscrossed: .

Michael Morris
2023-03-23 12:09:30

*Thread Reply:* No, if the TSX module is installed Typescript can translate TSX straight to JS.

Ange
2023-02-26 18:24:48

@Ange has joined the channel

Ange
2023-02-26 18:26:05

Hi Team , Im new to Cucumber Can someone please tell me how to share data between steps in one scenario using Cucumber.js, Thanks

✅ David Goss
David Goss
2023-02-26 21:57:42

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md

Ange
2023-02-26 21:58:34

*Thread Reply:* Thanks for this

👍 David Goss
Rawan Alenezi
2023-02-27 16:14:48

@Rawan Alenezi has joined the channel

Thai Nguyen
2023-02-28 22:13:48

@Thai Nguyen has joined the channel

Tấn Dũng Nguyễn
2023-03-07 17:11:26

@Tấn Dũng Nguyễn has joined the channel

A.K.
2023-03-15 08:45:15

@A.K. has joined the channel

Zulema Arteaga
2023-03-15 13:38:05

@Zulema Arteaga has joined the channel

Andrew Robinson
2023-03-17 02:57:06

@Andrew Robinson has joined the channel

Tally Barak
2023-03-22 06:48:27

Hi, anyone knows of customizations options for the junit formatter? specifically - can I set the name in the report (currently it is cucumber-js). any other options?

✅ David Goss
David Goss
2023-03-22 07:05:37

*Thread Reply:* Not currently possible, but something we could look at adding via formatOptions. Would you mind raising a feature request at https://github.com/cucumber/cucumber-js/issues/new/choose

luke
2023-03-22 08:32:28

*Thread Reply:* In ruby I know we cannot set the name of the files, but we can set the name of the directory. Not sure if this helps or not @David Goss (I think the filenames are semi fixed, cos of reporter tools upstream).

Vidhya
2023-03-27 11:11:56

Hi, What is the maximum thread count I can use in parallel execution, Results are not stable if I use 5 and above..

✅ David Goss
David Goss
2023-03-27 12:04:22

*Thread Reply:* There’s no technical maximum from Cucumber’s perspective. The limiting factors will be the hardware you run on (the more you do in parallel, the more memory will be consumed by each worker), and the ability of your system under test to handle the parallel activity (shared resources, dependencies between scenarios, etc).

👍 Vidhya
David Goss
2023-03-27 12:04:58

*Thread Reply:* I’ve most commonly seen people use between 4 and 8.

Vidhya
2023-03-27 12:16:37

*Thread Reply:* Thanks for your response, I am running the scripts on the docker container hosted in kubernetes cluster, I see only till 4 thread, the results are stable

Aleksandar KIRILOV
2023-04-02 13:48:38

@Aleksandar KIRILOV has joined the channel

Shatha
2023-04-18 01:32:55

@Shatha has joined the channel

Shatha
2023-04-18 01:51:55

Hey! Hope you all are doing good, can you please any of you share with me your experience or any resource that can help me in my case: I am recently joined cucumberJS club and I need to run the tests in parallel, but i found nothing that could help me i am using @cucumber/cucumber: 9.0.1 and if it can be enriched with an example to be able to understand it

David Goss
2023-04-18 03:17:38

*Thread Reply:* Have you seen https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md

Shatha
2023-04-18 03:18:31

*Thread Reply:* Yup, actually i found it after posting the question, but i did not get this part

Shatha
2023-04-18 03:18:39

*Thread Reply:* • In a configuration file { parallel: 3 }

slackbot
2023-04-18 01:51:56

Guten tag! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Tim Yao
2023-04-20 04:53:14

Hi, can cucumber-js allow step definition to be overridden? Here is a user story: As a tester, I can define a higher priority step definition to override the default step definition, so I can reuse the existing feature tests in multiple projects with the flexibility to extend them when I need. I saw this for ruby https://makandracards.com/makandra/37067-override-cucumber-steps-without-an-ambiguity-error But not sure if we have a way to do it in js.

Michael Morris
2023-04-21 09:08:02

*Thread Reply:* There is nothing in the language that prevents this, and further you can actually pull it off in userland since JavaScript allows functions to be overwritten. I'm open to developing this into core if the core team approves, but I need to know a bit more on this - specifically what are the use cases?

luke
2023-04-20 05:03:00

What you have to remember is that is a spin-off plugin. Nothing there is official. Even just the notation using end.method is very non-standard.

So in theory you could do the same in js if you wanted?

Tim Yao
2023-04-20 05:11:49

*Thread Reply:* Have you had the need to reuse a set of feature tests? And allow others to extend the step definitions when they need?

luke
2023-04-20 05:12:11

*Thread Reply:* Not really, because you're kind of attacking the problem incorrectly.

luke
2023-04-20 05:12:32

*Thread Reply:* Two situations likely will occur. You want a standard cucumber cuke -> Where things like aruba are a massive help

luke
2023-04-20 05:13:10

*Thread Reply:* Or you want a situation where you want the "first bit of" cuke 1. Or the "middle bit of" cuke2. In that situation you are incorrectly storing reproducible information in the cuke, where it should live in a class/helper/OO object.

Tim Yao
2023-04-20 05:14:42

*Thread Reply:* I have a test suite, I need to use it to test multiple projects. However, a few projects have some customisation which makes all tests fail. If I can override one step definition for that project, then it should be fine.

luke
2023-04-20 05:15:05

*Thread Reply:* aaaah oki, so you have similar to cucumber. golden features?

luke
2023-04-20 05:15:39

*Thread Reply:* So I would fix your testing code to be properly modular.

luke
2023-04-20 05:15:46

*Thread Reply:* this is known as the screenplay pattern.

Tim Yao
2023-04-20 05:15:47

*Thread Reply:* what is cucumber. golden features ?

luke
2023-04-20 05:16:23

*Thread Reply:* so in cucumber, we have a concept known as golden. Which is where we have an input and output, and we put a different "engine" in the middle.

The test is that with the same input, and a different engine, we "should" get the same output.

luke
2023-04-20 05:16:31

*Thread Reply:* i.e.

Feature: Blank

luke
2023-04-20 05:16:35

*Thread Reply:* as the input.

luke
2023-04-20 05:16:45

*Thread Reply:* should always produce. foo - bar as the output.

luke
2023-04-20 05:16:55

*Thread Reply:* I can't remember the exact output. But it's on github somewhere.

luke
2023-04-20 05:18:09

*Thread Reply:* https://github.com/cucumber/gherkin/tree/main/testdata is one example for gherkin

luke
2023-04-20 05:18:21

*Thread Reply:* So



Feature: Inconsistent cell counts

  Scenario: minimalistic
    Given a data table with inconsistent cell count
      | foo | bar |
      | boz | 


  Scenario Outline: minimalistic
    Given the &lt;what&gt;

  Examples: 
    | what       |
    | minimalism | extra 
luke
2023-04-20 05:18:37

*Thread Reply:* should always produce

{"parseError":{"message":"(6:7): inconsistent cell count within the table","source":{"location":{"column":7,"line":6},"uri":"../testdata/bad/inconsistentcellcount.feature"}}} {"parseError":{"message":"(14:5): inconsistent cell count within the table","source":{"location":{"column":5,"line":14},"uri":"../testdata/bad/inconsistentcellcount.feature"}}}

luke
2023-04-20 05:19:00

*Thread Reply:* and we test that with about 10 diff "engines"

Tim Yao
2023-04-20 05:20:40

*Thread Reply:* Let me think...not exactly same situation but kind of...

Tim Yao
2023-04-20 05:22:57

*Thread Reply:* I can always handle them in a centralised step definition file, by checking what test target is, then handle them differently. But in my case, I am looking for a distributed way to allow it to be handled in each project.

Tim Yao
2023-04-20 05:25:23

*Thread Reply:* It's like Interface , I want each project can have their own implementation, maybe

Tim Yao
2023-04-20 05:25:57

*Thread Reply:* But I have a same test scenario, like what your example shows.

luke
2023-04-20 06:24:27

*Thread Reply:* yes so you want either screenplay pattern, or you have situation2 where you're not using common helpers/classes

Aleksandar KIRILOV
2023-04-20 06:51:28

*Thread Reply:* Hi @Tim Yao I am curious why would you need to "reuse and extend" step definitions ? For me they describe a very precise business logic and should in theory be unique per project

luke
2023-04-20 06:52:52

*Thread Reply:* reusing step defs is quite common if they're generic ones. Which is what aruba provides users with

Aleksandar KIRILOV
2023-04-20 07:04:54

*Thread Reply:* ah sorry I thought you were talking about the gherkin itself

Tim Yao
2023-04-20 16:11:41

*Thread Reply:* @Aleksandar KIRILOV It's actually is reuse feature file...Like the example of the golden feature, I want to reuse it to test multiple projects. The business logic in the test steps are same, but each project may have different implementations for certain steps, and they are agnostic to me.

Michael Morris
2023-04-21 09:11:02

*Thread Reply:* Each project can have their own step definitions. Those can call common support call to prevent code duplication.

Michael Morris
2023-04-21 09:11:38

*Thread Reply:* You could also have one common set of step definitions for those steps that do not need redefinition between patterns.

Michael Morris
2023-04-21 09:12:05

*Thread Reply:* The more you describe the problem, the more it seems this can be steered around.

Tim Yao
2023-04-21 14:53:15

*Thread Reply:* Thanks, Those can call common support call to prevent code duplication. not sure how to do that @Michael Morris. Can you please give more details?

Michael Morris
2023-04-21 15:41:45

*Thread Reply:* Given this directory structure /steps /project1 /project2 /project3 /common /support You could then load the step definitions for project1 with cucumber-js --require /steps/project1/****/**.js --require /steps/common/****/**.js

Michael Morris
2023-04-21 15:43:11

*Thread Reply:* Then your project step definitions could import from /support and extend those methods or do some config method before calling those methods.

Michael Morris
2023-04-21 15:43:44

*Thread Reply:* There's a multitude of paths to go through here. Without knowing more specifics I don't know which ones are best.

Tim Yao
2023-04-21 20:05:23

*Thread Reply:* OK. I got that. It does solve some of the cases. But I can't have one js file for each definition. Using require load way, I can't exclude one step definition from one file which contains other steps I need.

Tim Yao
2023-04-21 20:08:51

*Thread Reply:* I am also thinking about creating abstraction inside the step definition that may need to be extended. Inside that step definition, use JS to call a function that will load code dynamically which can allow project to override the default code.

Michael Morris
2023-04-22 10:21:02

*Thread Reply:* require can be invoked multiple times (so can import)

Michael Morris
2023-04-22 10:21:19

*Thread Reply:* Use your cucumber config file to set up a profile for each project

Michael Morris
2023-04-22 10:21:35

*Thread Reply:* And have the profile load the definitions needed by that project.

Tim Yao
2023-04-23 01:04:14

*Thread Reply:* Thanks. Here is what I think is a work around:

  1. split the step definitions that need to be overridden into a separate file.
  2. Then use the profile to include/exclude that file.
  3. In different projects, chose the profile they need. I think it will work as long as the customisation needs are small, which is what we are. Should be ok.
luke
2023-04-20 05:03:22

As the defacto ruby maintainer, I'd never heard of that. But it seems nice. Not quite sure when you'd use it though

plocket
2023-04-23 18:27:51

Does someone have a good idea where the chat is for puppeteerjs? I’m trying to type new lines into a text area, and handle.type("first line\nsecond line") isn’t doing it - it just types that text literally. I’ve been searching for hours online, but can’t find an answer.

David Goss
2023-04-23 23:43:13

*Thread Reply:* I’m not aware of a puppeteer community.

Have you tried using a template literal for the input string?

Aleksandar KIRILOV
2023-04-24 01:05:45

*Thread Reply:* @plocket you can use page.evaluate and it becomes just javascript.

https://sabe.io/blog/javascript-line-breaks-textarea#:~:text=To%20add%20a%20line%20break,character%20to%20the%20next%20line.

Sabe
plocket
2023-04-24 06:02:06

*Thread Reply:* Hmm, that might be needed when using .value, but this problem may be in combination with cucumber - when I manually code handler.type("Foo\nBar"), I do get multiple lines in the text area, but when I use the value that cucumber passes in as an argument, I don’t get any new lines, just literally “Foo\nBar” in the text area. (Example step: Then I type "Foo\nBar"). Is cucumber stringifying the argument first?

Aleksandar KIRILOV
2023-04-24 08:07:04

*Thread Reply:* I think doc strings is what you need https://cucumber.io/docs/gherkin/reference/

➕ David Goss
plocket
2023-04-24 16:06:00

*Thread Reply:* That’ll work in most places for us, but sometimes it needs to be in a table.

plocket
2023-04-25 16:00:26

*Thread Reply:* Is there another way, @Aleksandar KIRILOV?

plocket
2023-04-27 05:57:10

*Thread Reply:* It needs to work in a table as well, not just as a doc string. Any ideas?

Aleksandar KIRILOV
2023-04-27 06:17:55

*Thread Reply:* Hello @plocket just use JS string.replace() to replace your escaped \n by \n - this is mostly code related at this point not gherkin issue imo

plocket
2023-04-27 14:35:07

*Thread Reply:* ~Thank you. I was having trouble understanding how cucumber was processing the string. I tried to experiment to find out, but kept getting tripped up by the backslashes. How do I make sure to unescape other characters? I’ve been trying to look it up online for a few hours now. The most I could find was~ .replace(/\\{2,}/g, '\\') ~But I experimented with that and it didn’t work at all. I did 'foo\\nbar'.replace(/\\{2,}/g, '\\') in the console and it just came back as 'foo\\nbar' .~

plocket
2023-04-27 14:36:45

*Thread Reply:* Instead of that, can you point me to where in the cucumberjs code the string is being escaped? That way I can better try to unescape it. I’ll ask on js channels about that.

plocket
2023-05-01 05:28:30

*Thread Reply:* Is it something like JSON.stringify or is it a Markdown parser?

David Goss
2023-05-01 05:41:29

*Thread Reply:* You may be looking for https://github.com/cucumber/cucumber-expressions

Stars
100
Language
Java
plocket
2023-05-01 05:42:37

*Thread Reply:* Thanks! Do you know where in there the “stringifying” is going on?

Pras
2023-04-27 13:59:07

@Pras has joined the channel

Shatha
2023-05-01 04:56:37

Hey, question: is there any thought if I can print out the console logs along with the reports generated by cucumber?

plocket
2023-05-01 05:29:44

*Thread Reply:* We use console.log() in our AfterAll() hook and that works fine if that’s what you mean.

Shatha
2023-05-01 05:30:46

*Thread Reply:* it logs all the logs that have been logged during the run and through all steps?

plocket
2023-05-01 05:31:38

*Thread Reply:* We add those to a string variable as we go and print the whole thing at the end.

plocket
2023-05-01 05:33:09

*Thread Reply:* That said, if you console log during the tests, that shows up too. I think there is something you can do with the… formatter (?) that can influence the output. Also, we create a file we call a “report.txt” that contains all our logs. [We use that same string that I described.]

Shatha
2023-05-01 05:35:26

*Thread Reply:* you externally created a file for logs and added it to reports, or sth already built-in?

plocket
2023-05-01 05:36:09

*Thread Reply:* We currently don’t add it to the “published” report. We just add it to our directory and .gitignore it.

Shatha
2023-05-01 05:36:53

*Thread Reply:* and maybe i was not clear in asking my question; what i meant in my question is I need to add the logs to the published report

Shatha
2023-05-01 05:37:11

*Thread Reply:* any idea, how can i add it to the published report?

plocket
2023-05-01 05:38:02

*Thread Reply:* I think I’ve seen folks talk about something called the formatter. Do other folks know if that’s right? Would that affect the published report? (posting to channel)

David Goss
2023-05-01 05:40:05

*Thread Reply:* Formatter == reporter

David Goss
2023-05-01 05:40:51

*Thread Reply:* There is this.log() which is just shorthand for doing a plain text attachment - not sure if that helps @Shatha

Shatha
2023-05-01 05:42:49

*Thread Reply:* is it something that can help in having all of the logs at the end of the run? or attached in the report folder? and if so, can you help me in how to apply that?

Matthias Carell
2023-05-03 06:53:25

@Matthias Carell has joined the channel

Shatha
2023-05-09 23:54:05

hey champs, i have a question: is there any way to re-run specific step if it has failed for some reason?

plocket
2023-06-25 15:22:40

*Thread Reply:* I’ve done this by handling the logic internally - I abstract the functions that I define in a Step. Then I catch certain types of errors and call the function again if appropriate.

luke
2023-05-10 01:37:50

a step no. Because the concept of a scenario is an enclosed container.

Why would you want to do this. It feels very hacky. The only way I would do this would be using your low-level language. And wrapping the entire thing in a helper.

luke
2023-05-10 01:37:57

Given('flaky step') do run_with_retries(attempts: 2) end

luke
2023-05-10 01:39:27

def run_with_retries(attempts: 1) begin # code block rescue [ErrorsYouThinkMightOccur] retry if logic_met? end end

Matthias Carell
2023-05-10 04:21:29

@Shatha You could also add a tag to the scenario (for example @debug) and call this specific scenario using the -t option (eg., npx cucumber-js -t @debug) In addition you might be able to comment single steps out in Gherkin. But as @luke already hinted this could break expected dependencies between your steps.

Vidhya
2023-05-16 07:13:14

Can we access world parameter in Before All Method <#C6QJ6N695|help-cucumber-js>

Aleksandar KIRILOV
2023-05-16 07:18:46

*Thread Reply:* The doc says it is not possible:

https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/hooks.md#beforeall--afterall

Can you tell us more about your use case ? If you need to access the world inside BeforeAll maybe you are trying to use it in a wrong way

Vidhya
2023-05-16 07:24:00

*Thread Reply:* I want to connect to Database and common setup (one time setup in test suite level) in before All method in parallel execution, If i connect to DB in before method , I have to create the data setup for every scenario, Data is creating in runtime, so it cannot interact with the other threads which is running in parallel, so I have to create in before all

Aleksandar KIRILOV
2023-05-16 07:39:26

*Thread Reply:* Do you need the world object to do such technical things like connecting to a database ? Just put your SQL in a file and load it in the "BeforeAll"

Also imo it is a good practice to have separate dataset for each test - this way you get better isolation and your tests will not leak.

Vidhya
2023-05-16 07:42:13

*Thread Reply:* I have different DB env and based on the world parameter env , I want to connect to that DB

Vidhya
2023-05-16 07:43:03

*Thread Reply:* It is having application constraint that only one record created for Admin and I want to access the admin account after creating it in one thread

Shatha
2023-05-17 07:33:44

hey, i have a question, is there any way I can ignore packages from being transpiled? I already have them transpiled and I don’t want them to be transbiled when adding requireModule: ['ts-node/register'],

Aleksandar KIRILOV
2023-05-19 01:05:39

*Thread Reply:* I think you should create a second tsconfig.json for your test that has the appropriate includes and excludes and then you should specify that ts-node in your tests use that tsconfig. Not exactly sure of the syntax though - sorry

MarkSweetlove
2023-05-21 15:08:21

Hi, hopefully someone can help me - When adding a custom formatter, is there any way in the constructor to know if the run is parallel or not? It seems there are no environment variables set at that point and the cucumber options don’t give any clues. Thanks

Selim
2023-05-22 06:37:13

@Selim has joined the channel

Selim
2023-05-22 06:41:45

hey guys, I have 2 steps: • Then I send a request to Web property api with random property id • Then I send a request to NA property api with random property id and a step implemented for these 2 like this: Then(“I send a request to (NA|Web) property api with random property id”, (api) => { but when I run it for web, it says: Step implementation missing for: I send a request to Web property api with random property id how can I fix it by regex usage, any help is appreciated 🙌

Aleksandar KIRILOV
2023-05-22 08:51:07

*Thread Reply:* You can read the https://github.com/cucumber/cucumber-expressions#alternative-text

If you need full control then use regex expressions.

PS: Imo you should write your step as follows:

Then I send a request to Web and NA property api ...

Reuse code in your glue and keep your feature files clean and readble.

Aleksandar KIRILOV
2023-05-22 08:51:55

*Thread Reply:* Also gherkin is about business logic and you seem to be testing some technical APIs - maybe you should take a look at karate

Selim
2023-05-23 05:12:53

*Thread Reply:* hey @Aleksandar KIRILOV thanks for your reply

Selim
2023-05-23 05:13:54

*Thread Reply:* this medium article helped me to fix the issue: https://medium.com/taqtilebr/testing-front-end-applications-with-cucumber-and-cypress-9666771bc8c4 and this step definition is working fine in my case: Given(/I send a request to (NA|Web) search api/, (api) =&gt; {

Medium
Reading time
6 min read
👍 Aleksandar KIRILOV
Tim Yao
2023-05-25 15:27:09

*Thread Reply:* In cucumber expression, you also can use custom parameter type https://github.com/cucumber/cucumber-expressions#custom-parameter-types But it adds extra code which defines your reusable type, like: ```import { defineParameterType } from '@cucumber/cucumber'

defineParameterType({ name: 'propertyName', regexp: /Web|NA/, transformer: s => s })```

🙌 Selim
slackbot
2023-05-22 06:41:46

Salutations Earthling! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Eric Dantas
2023-05-26 00:53:51

Hi there, I hope everyone is doing well. I'm using cucumber-tsflow and I'm getting an error when try to use beforeAll annotation.

I've updated my local using version 4.0.3 and now I can see/import beforeAll/afterAll. However, I'm getting a "binding" error when trying to use context injection and beforeAll decorator. If I use before decorator, everything works fine.

Here is how I'm using it: ```@binding([Login, Client]) class HookSteps { constructor(protected login: Login, public client: Client) { } @beforeAll() public async beforeAll(): { await this.login.LogIn() await this.client.Client(this.login) ... } }

Here is the error that I'm getting:
```VError: a BeforeAll hook errored, process exiting: tests\functional\features\support\hooks.ts: Cannot read property 'LogIn' of undefined
   at Runtime.runTestRunHooks (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\runtime\run_test_run_hooks.ts:32:19)
   at processTicksAndRejections (internal/process/task_queues.js:95:5)
   at async Runtime.start (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\runtime\index.ts:103:5)
   at async runCucumber (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\api\run_cucumber.ts:125:19)
   at async Cli.run (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\cli\index.ts:78:25)
   at async Object.run [as default] (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\cli\run.ts:38:14)
caused by: TypeError: Cannot read property 'LogIn' of undefined
   at Object.BeforeAll (c:\project\code\myapi\test\functional\features\support\hooks.ts:17:22)
   at globalBindFunc (c:\project\code\myapi\node_modules\cucumber_tsflow\src\binding_decorator.ts:256:48)
   at Object.run (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\user_code_runner.ts:37:21)
   at Runtime.runTestRunHooks (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\runtime\run_test_run_hooks.ts:21:50)
   at Runtime.start (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\runtime\index.ts:103:16)
   at runCucumber (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\api\run_cucumber.ts:125:33)
   at async Cli.run (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\cli\index.ts:78:25)
   at async Object.run [as default] (c:\project\code\myapi\node_modules\@cucumber\cucumber\src\cli\run.ts:38:14)

Any thoughts on that?

luke
2023-05-26 01:07:16

beforeAll doesn't have a world object. That might be where the issue comes from.

Eric Dantas
2023-05-26 01:59:45

Design or bug? What do you think?

Eric Dantas
2023-05-26 02:26:14

Thank you

luke
2023-05-26 03:17:18

Sorry missed this. Yes deliberately. There are some ways in some languages to get some sort of configuration instance, but by and large it doesn't make sense as the world is inherently tied to running tests, which beforeall/afterall aren't quite yet doing.

Eric Dantas
2023-05-26 04:34:00

How can I do an unique login for all scenarios? I have over 2000 scenarios... it is doing new login for each of them... that's why I would like to add this into beforeAll

luke
2023-05-26 05:50:08

so if you want to login for each scenario you simply place that in your before hook.

Eric Dantas
2023-05-26 11:39:04

That's what I have now... logging in for each scenario, but I want to logging in just once, and the credentials can be used for all scenarios

plocket
2023-06-25 15:29:12

*Thread Reply:* Something like this? ```let username; let password;

BeforeAll(function () { username = random(); password = random(); });

Then(...() { loginwith( username, password ); });```

plocket
2023-06-25 15:39:45

*Thread Reply:* From what I just read about BeforeAll when running in parallel (just below this), this solution won’t work if you’re running tests in parallel. Maybe you’d define them right at the start: let username = random(); let password = random();

Eric Dantas
2023-05-26 11:39:55

That's why I would like to use beforeAll

Shatha
2023-06-05 15:35:23

Hey, I have a question: how can I run “BeforeAll” once - at the beginning of the class and not to be running many times in parallel - since i am enabling the “parallel”

Aleksandar KIRILOV
2023-06-06 00:42:41

*Thread Reply:* I haven't used parallel testing but I think there is a variable set in the process.env that tells you the executor ID. You might use that to do something like

if(process.env["CUCUMBERWORKERID"] === 1)

Aleksandar KIRILOV
2023-06-06 00:43:17

*Thread Reply:* Can you tell us what is your use case why do you need it to run only once ?

Shatha
2023-06-06 00:44:18

*Thread Reply:* so i am building api tests and i need before running the tests to create users per supported countries to be used in my test

Shatha
2023-06-06 00:45:00

*Thread Reply:* > if(process.env["CUCUMBERWORKERID"] === 1) this one to be set in beforeAll right

Aleksandar KIRILOV
2023-06-06 00:45:14

*Thread Reply:* yes (btw use === 0 instead of 1)

Aleksandar KIRILOV
2023-06-06 00:45:25

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md

Shatha
2023-06-06 00:45:26

*Thread Reply:* got you will test it out and see

Aleksandar KIRILOV
2023-06-06 00:46:13

*Thread Reply:* just before you go: as a best practice each test should have it's own data set and cleaned at the end to avoid leaking so what you are doing is a bit a "quick and dirty"

Aleksandar KIRILOV
2023-06-06 00:46:35

*Thread Reply:* IMO each test should create the user in the BeforeAll and in AfterAll should clean them

Aleksandar KIRILOV
2023-06-06 00:46:55

*Thread Reply:* this will slow down a bit your tests but will make them more stable

Shatha
2023-06-06 00:49:34

*Thread Reply:* Hmmm… got your point!

Shatha
2023-06-06 00:50:30

*Thread Reply:* but the thing in my case, there is no value of creating new users for each test because i am creating them for the sake of testing the API, that does no write or modifications

Shatha
2023-06-06 00:50:49

*Thread Reply:* but got your point, need to revise it

Aleksandar KIRILOV
2023-06-06 01:02:06

*Thread Reply:* I hope I could help you 🙂 Happy testing !

luke
2023-06-07 01:33:40

*Thread Reply:* Instead of doing this instead you should be using a more model based approach. I've done this in my last few jobs and I'm going to make a gem based off this I think going forward

Your tests should be doing something like

Given usertype A

This then does a findorcreate by "logic"

Shatha
2023-06-07 01:46:15

*Thread Reply:* Hmm, did not get your point fully mind sharing an example!

luke
2023-06-07 03:07:04

*Thread Reply:* ```Scenario: A user who likes apples can look at a shopping list Given a user who is an apple fan Then they are able to open the shopping list

steps

Given('a user who is an apple fan') do # logic to find or create a user who is an apple fan end```

Tim Yao
2023-06-09 21:12:42

*Thread Reply:* There is a open issue https://github.com/cucumber/cucumber-js/issues/1153

Labels
🙏 help wanted, ✅ accepted, ⚡ enhancement
Comments
34
Tim Yao
2023-06-09 21:13:43

*Thread Reply:* PR but no progress https://github.com/cucumber/cucumber-js/pull/2140

Comments
3
Assignees
<a href="https://github.com/mattwynne">@mattwynne</a>, <a href="https://github.com/tim-yao">@tim-yao</a>
Tim Yao
2023-06-09 21:15:49

*Thread Reply:* My workaround is use another script to run the required test condition setup before I run the cucumber-js testing. I pipelined them in CI. I think it's also easy to setup in npm script as well.

Shatha
2023-06-13 05:58:52

*Thread Reply:* @Tim Yao can you show me an example

luke
2023-06-13 06:53:54

*Thread Reply:* it would be something like (Say in jenkins)

```stage('prior setup') { steps { sh 'run your step here' } }

stage('cucumber') { steps { sh 'bundle exec cucumber' } }```

Tim Yao
2023-06-13 19:30:22

*Thread Reply:* yes, @luke posted is what I mean

luke
2023-06-14 02:59:51

*Thread Reply:* @Tim Yao I assume you're the same person from the issue/PR. But in essence I've marked the issue as won't fix, and I advise the PR to go the same route. It's solving a problem that in essence isn't broken in my eyes. But I'll let other people maybe provide more input. You've even articulated here a better solution which I wholeheartedly agree with.

I appreciate you may have spent some time on the original PR, and as such won't close that (Plus I'm no JS expert). But either way it's great to see you contributing and please don't stop on my behalf.

👍 Tim Yao
Tim Yao
2023-06-14 03:32:05

*Thread Reply:* I left a comment in the pr for David to decide 😁

👍 luke
Chandrika
2023-06-13 00:52:07

Hello I have an issue where driver.get is not pasting the url after browser is launched .

Just a background this was working before now suddenly the driver.get is not working-Issue resolved

Chandrika
2023-06-13 06:10:26

*Thread Reply:* Issue resolved by upgrading selenium Webdriver and geckodriver

luke
2023-06-13 01:18:27

This is a selenium issue @Chandrika not cucumber. (Or WDIO perhaps from the name of your stuff).

👍 Luděk Nový, Chandrika
Nigel
2023-06-14 09:04:57

@Nigel has joined the channel

Terence Tian
2023-06-14 17:06:59

@Terence Tian has joined the channel

plocket
2023-06-25 15:55:13

My users provide their services in different languages to increase accessibility to vulnerable populations who don’t have good support right now. Sometimes they have 5 languages and hope to add more. They need to be able to test each language separately, so each language can fail separately - each translation could introduce changes in the code (yeah, it sucks, but life’s not perfect and we’re stuck with it). If they have 10 tests and 5 languages, that means writing and maintaining 50 tests, which is a bit much.

Do folks have ideas for how to automate this? They can set the languages in a Background or something, or even in env vars, but I’m not sure what to do with them at that point. A reply in a thread would be most helpful, thank you.

Matthias Carell
2023-06-26 00:39:29

*Thread Reply:* I’m not sure about if I can understand the problem: do you have to provide Gherkin Scenarios in different languages or does your application support multiple languages or do you have to test your application for multi-language environments (eg., browsers, OS’s)?

plocket
2023-06-26 05:31:58

*Thread Reply:* The applications support multiple languages and each language needs to be tested independently, @Matthias Carell. Without some special behavior, each language would need its own Gherkin Scenarios that were otherwise identical to those of the other languages. Does that make more sense?

Matthias Carell
2023-06-26 07:23:19

*Thread Reply:* I see. I think I would use data tables like this: ```Given the user has set the app language to <language_name> And the cancel button shows the corresponding label | lang | label | | en | cancel | | de | Abbruch | When the user clicks on the button Then a message confirms this action | lang | label | | en | Action canceled | | de | Aktion abgebrochen |

Examples: multi language cancellation | language | language_name | | en | English | | de | German |``` This way you can use the same scenario for multiple languages. The Examples section (Outline table) would repeat the scenario for each language while the steps with data tables could pick the actual language setting accordingly.

plocket
2023-06-26 15:11:26

*Thread Reply:* Wow, I wasn’t aware of Examples. I’ll have to look at how they work. Still some extra work to run languages only conditionally, but we can handle that other ways. I’ll look into this and see if it suits our purposes!

Matthias Carell
2023-06-27 02:13:45

*Thread Reply:* Examples: are part of Scenario Outlines as described here https://cucumber.io/docs/gherkin/reference/#scenario-outline Newer versions of Cucumber do recognize Examples: without starting the scenario with Scenario Outline:

Matthias Carell
2023-06-27 02:25:37

*Thread Reply:* Regarding how to run only selected languages please look at https://cucumber.io/docs/cucumber/api/?lang=javascript#tags You will find an example that have multiple example tables for a single outline scenario. This allows you to add tags to each example table like this: ```Scenario Outline: show feedback on cancel action Given the user has set the app language to <language_name> And the cancel button shows the corresponding label | lang | label | | en | cancel | | de | Abbruch | When the user clicks on the button Then a message confirms this action | lang | label | | en | Action canceled | | de | Aktion abgebrochen |

@langen Examples: cancellation in english | language | languagename | | en | English |

@langde Examples: cancellation in german | language | languagename | | de | German |``` Now you can use tags to run scenarios only for a selection of all available languages.

plocket
2023-06-27 06:41:00

*Thread Reply:* Thanks, this is a really strong lead and I’ll look into it! I must say there were no docs on cucumberjs about this capability existing in cucumberjs. Is there a doc that describes either that cucumberjs always has the same capabilities as cucumber? Or that lists which features it has implemented so far?

Matthias Carell
2023-06-27 08:09:41

*Thread Reply:* When I say Cucumber I don’t have a specific version in my mind. The docs from cucumber.io/docs should match with the current version of cucumberjs If a feature is language specific the page offers you a filter to show the doc related to the right language:

👀 plocket
Matthias Carell
2023-06-27 08:15:33

*Thread Reply:* However most Cucumber versions should support most aspects of the Gherkin language. I would expect all more mature versions (eg. cucumberjs or cucumber for Java) to support scenario outlines. If you want to learn more I would recommend Writing Great Specifications. I learned a lot from this book.

👍 plocket
Michael Morris
2023-06-27 10:52:29

*Thread Reply:* I built a test suite that had multiple language support - 12 of them. The language to be tested was passed as a world parameter. Gherkin steps did not refer to the exact text that would be appearing nor should they - they aren't supposed to contain details that small.

plocket
2023-06-27 14:20:31

*Thread Reply:* Yes, I agree Gherkin steps should avoid referring to the exact text. We’re making the steps language agnostic generally. The only reason that we need to test with every language is to make sure that the translators don’t mess up the code. That is, we won’t need the tables that check for words from the different languages, though I do appreciate you providing those in the example.

We do have a weird use case, and languages is only one reason, so that we can support vulnerable users. If you ever want to get into it, let me know ;)

plocket
2023-06-27 14:26:57

*Thread Reply:* That said, our internal tests to make sure we’re handling languages properly will definitely use the example tables you showed to look for phrases so that we can be sure we’re actually testing languages correctly.

plocket
2023-06-27 14:29:59

*Thread Reply:* ~Quick question: Can the example tables have multiple rows? I’m not sure why you split those rows into separate tables.~ I think I understand - they have different tags.

👍 Matthias Carell
Michael Morris
2023-06-27 16:28:40

*Thread Reply:* Are you sure you're not reinventing the wheel? The implementation my team used put all the translations into a json file structured something like this: { "color": { "US": "color", "UK": "colour", "other": "color" } }

Michael Morris
2023-06-27 16:29:07

*Thread Reply:* Each major language has a file, and regional variation is covered by the nation codes as seen above.

Michael Morris
2023-06-27 16:29:24

*Thread Reply:* The test steps can refer to the translation by their key.

Michael Morris
2023-06-27 16:30:32

*Thread Reply:* The tests then load the same language file the code under test is using. If the code is working correctly it should provide a match.

Michael Morris
2023-06-27 16:31:28

*Thread Reply:* Javascript has multiple i18n implementations. I wouldn't recommend inventing yet another one - do some research, find an existing solution you like and save yourself a headache.

plocket
2023-06-27 16:31:44

*Thread Reply:* I can’t control how the translation is arranged. As I said in the original post, it sucks, but life isn’t perfect and that’s what we’ve got.

Michael Morris
2023-06-27 16:32:38

*Thread Reply:* The code under test should be arriving at it using some process similar to the above. If not sourced from a json file perhaps sourced from an API endpoint?

Michael Morris
2023-06-27 16:33:11

*Thread Reply:* Whichever is used the testing code should independently fetch the value from the source, then verify the code under test is displaying it.

Michael Morris
2023-06-27 16:33:45

*Thread Reply:* Each translation string almost certainly has an identifying key. I've never seen a translation system that didn't do this.

plocket
2023-06-27 16:34:53

*Thread Reply:* Does it matter how the language is being triggered? The end to end test goes to the url for the appropriate language. It’s in the url args.

plocket
2023-06-27 16:35:28

*Thread Reply:* If you want to discuss the translation situation, maybe we can DM about that?

Michael Morris
2023-06-27 16:39:50

*Thread Reply:* It shouldn't matter how the language is triggered so long as the testing code has access to the translation strings.

Michael Morris
2023-06-27 16:40:19

*Thread Reply:* And I'll be happy to take a few DM's. Since I'm between jobs I've got the free time.

👍 plocket
luke
2023-06-28 01:56:23

*Thread Reply:* if the scenarios proper can be written in english, I would write the scenarios once without outlines, then use a config tool to pass in your dynamic language. It makes writing tests 10x easier.

luke
2023-06-28 01:56:41

*Thread Reply:* Use things like hash lookups or yml files to store your i18n translations.

luke
2023-06-28 01:56:56

*Thread Reply:* Unless you explicitly want the translations visible in your report.

plocket
2023-06-28 06:01:34

*Thread Reply:* That sounds like an interesting alternative, @luke, but I’m not quite understanding. Why do I need a scenario outline if I’m not going to use Examples? How/where would I use the config values? Can you give me a small example?

luke
2023-06-28 06:01:52

*Thread Reply:* you wouldn't use scenario outline.

luke
2023-06-28 06:02:10

*Thread Reply:* you would write one scenario for each use case, and use i18n to translate

✅ plocket
plocket
2023-06-28 06:03:07

*Thread Reply:* Ah, I [accidentally] read ‘without’ as ‘with’

👍 luke
luke
2023-06-28 07:41:11

*Thread Reply:* You can then feed in the translation either as a cucumber step or an env var step. Easy-peasy

plocket
2023-06-28 07:43:25

*Thread Reply:* Not sure how I can make that kind of Step that wouldn’t require writing a test for each language. If I use env vars, I’m not sure how I’d make sure each language had its own unique test.

luke
2023-06-28 08:54:54

*Thread Reply:* Because you just lean on the env var in your step/support code and use i18n, it's literally designed for this.

luke
2023-06-28 08:55:11

*Thread Reply:* So you either have a given step, or an env var (Which you could set in a step or as a pre-req)

luke
2023-06-28 08:56:51

*Thread Reply:* ```Given('The website is in English') do I18n.locale = :en end

Given('The website is in Norwegian') do I18n.locale = :nb end

Then('I am welcomed to the homepage') do expect(@app.home.welcomemessage).to eq(I18n.t('home.welcomemessage')) end```

luke
2023-06-28 08:59:16

*Thread Reply:* or for env var you do something like

LANG=en cucucumber LANG=nb cucumber

plocket
2023-06-28 09:00:30

*Thread Reply:* What does the single Scenario look like that will run a test for each of English and Norwegian?

luke
2023-06-28 09:00:45

*Thread Reply:* ```Feature: Run test Scenario Outline: Validate homepage message Given the website is in <language> And I am on the homepage Then I am welcomed to the homepage

Examples:
  | language  |
  | English   |
  | Norwegian |```
plocket
2023-06-28 09:01:53

*Thread Reply:* So it does use Scenario Outline

luke
2023-06-28 09:02:04

*Thread Reply:* if you want to go down the route of using steps yes

luke
2023-06-28 09:02:13

*Thread Reply:* if you want to use env vars, then it depends if you want them in a step or not.

luke
2023-06-28 09:02:16

*Thread Reply:* it's literally up to you

luke
2023-06-28 09:02:29

*Thread Reply:* if you use env vars without steps then it would not have the outline

plocket
2023-06-28 09:02:39

*Thread Reply:* I think I’m trying to say that I don’t know how I’d do separate tests if I wanted to use env vars.

luke
2023-06-28 09:02:43

*Thread Reply:* Feature: Run test Scenario Outline: Validate homepage message Given I am on the homepage Then I am welcomed to the homepage

luke
2023-06-28 09:02:56

*Thread Reply:* LANG=en cucumber

plocket
2023-06-28 09:03:21

*Thread Reply:* Yes, and LANG=nb cucumber, but what’s the rest of the code?

luke
2023-06-28 09:03:30

*Thread Reply:* i've given you 90% of it

luke
2023-06-28 09:03:42

*Thread Reply:* so in your env.rb you would set the locale from the env var

plocket
2023-06-28 09:03:45

*Thread Reply:* Though I’m not sure how you can test both languages at the same time like that.

luke
2023-06-28 09:03:46

*Thread Reply:* in ruby that would look like

luke
2023-06-28 09:03:57

*Thread Reply:* I18n.locale = ENV.fetch('LANG')

plocket
2023-06-28 09:04:04

*Thread Reply:* Because LANG can’t have both values

luke
2023-06-28 09:04:10

*Thread Reply:* no so you run it twice.

luke
2023-06-28 09:04:14

*Thread Reply:* you run 50 tests in english

luke
2023-06-28 09:04:18

*Thread Reply:* then 50 tests in norwegian

plocket
2023-06-28 09:04:27

*Thread Reply:* Ah, ok, that clarifies it, thanks.

luke
2023-06-28 09:04:38

*Thread Reply:* or, you run 50 tests in both languages simultaneously.

luke
2023-06-28 09:04:53

*Thread Reply:* I don't know your business case. Maybe some tests only are valid in one language, and you don't want to tag your tests as @not_nb e.t.c.

luke
2023-06-28 09:05:44

*Thread Reply:* you could then have tasks that ran 1/multiple languages as a single script

luke
2023-06-28 09:05:53

*Thread Reply:* ```# commoneuropeanlanguages.sh

echo 'Running english' LANG=en cucumber sleep 1 echo 'Running swedish' LANG=sv cucumber sleep 1 echo 'Running french' LANG=fr cucumber sleep 1```

luke
2023-06-28 09:06:42

*Thread Reply:* then your ci (Say jenkins is)

luke
2023-06-28 09:06:44

*Thread Reply:* stages { stage('Run common languages') { sh('./common_european_languages.sh') } }

plocket
2023-06-28 09:10:32

*Thread Reply:* Thanks for clarifying that.

luke
2023-06-28 09:15:28

*Thread Reply:* Happy to help.

In short, one of two ways will help (IF you don't need the verbose translations visible to your report recipients).

Way 1 - Use env vars, inject them in - preferably silently, run your tests for 1 language Way 2 - create gherkin steps to pivot / switch languages, useful if your tests need to flit and flot between 1/2/3/4/5 languages per scenario / rule e.t.c.

✅ plocket
luke
2023-06-28 09:15:47

*Thread Reply:* And above all else, please lean on i18n if at all possible 😄 it's literally designed for this exact purpose

😢 plocket
Bryan Nahrwold
2023-06-26 07:54:09

@Bryan Nahrwold has joined the channel

Eliav Ran
2023-06-27 12:37:44

Hello there,

I have been utilizing cucumber-js for quite some time now. However, recently, while running the tests, we encountered a TypeScript issue that caused the test startup to fail. The problem was that cucumber didn't start running, and no tests were executed. Surprisingly, the test didn't fail the pipeline and exited with status 0.

Is there any way to configure cucumber to fail if no features/scenarios are executed during the test run?

Aleksandar KIRILOV
2023-06-27 12:53:45

*Thread Reply:* Hello, I would suggest to wrap your tests in a JS file and use the cucumber-js API to run your tests and add some logic that evaluates the number of steps ran and calls "process.exit(code)"

Aleksandar KIRILOV
2023-06-27 12:54:02

*Thread Reply:* https://github.com/cucumber/cucumber-js/blob/main/docs/javascript_api.md

Michael Morris
2023-06-27 16:38:31

*Thread Reply:* An expected scenarios count as a cli argument isn't a bad idea though.

Aleksandar KIRILOV
2023-06-27 22:21:05

*Thread Reply:* @Michael Morris or atleast "bigger than zero". Maybe we should open an issue in github ?

luke
2023-06-28 01:53:15

*Thread Reply:* 0 scenarios running isn't a failure. It's valid behaviour.

Aleksandar KIRILOV
2023-06-28 01:55:25

*Thread Reply:* @luke please read the full conversation - if missconfigured, cucumberjs can report that everything is OK when infact your tests are not ran at all. It will not alter any existing functionalities to add a simple --fail-on-no-tests parameter

luke
2023-06-28 01:57:37

*Thread Reply:* I have done. If the startup is wrong / faulty, cucumber doesn't know this. Again 0 tests being ran - irrespective of why, isn't an issue.

luke
2023-06-28 01:57:54

*Thread Reply:* If the tests "failed" to run, then that's a different situation.

Aleksandar KIRILOV
2023-06-28 02:00:32

*Thread Reply:* @luke sorry my friend. Ok then maybe wrapping the test run in a bash or js script can provide the additional logic that OP needs.

luke
2023-06-28 02:23:02

*Thread Reply:* Yeh, I'm not sure readily how easy that is to do / why you'd want to do that, but each to their own.

One way you can do it in ruby (I'm not sure if this exists in other languages), is the concept of a dry run

Eliav Ran
2023-06-28 03:19:57

*Thread Reply:* @luke It is not an expected result for the CI to have 0 tests run. I am not recommending that it always fails, but rather suggesting that a flag be added. This flag would indicate that if 0 tests are run, the expectation is for the run to fail.

luke
2023-06-28 03:20:31

*Thread Reply:* Sorry, that's just not the case, I'm not sure why you're thinking this. A simple use case would be

@not_used Feature: Abc Scenario: Def cucumber -t @abc

luke
2023-06-28 03:21:04

*Thread Reply:* This would run 0 scenarios.

luke
2023-06-28 03:21:27

*Thread Reply:* ```[17:25:53] luke@luke-ubuntu:~/Code/exordo-app-automation$ cucumber -t @abc 2023-06-28 11:21:10 - INFO - Automation Helpers - Adding patch: AutomationHelpers::Patches::SeleniumLogger 2023-06-28 11:21:10 - DEBUG - Automation Helpers - When using the Selenium Logger that is set to pipe to a file, the Net::HTTP adapter (default), can return unencoded binary (confusingly called ASCII-8BIT in Ruby). Consequently we set the logger to binmode so it doesn't try to encode the data - this would always cause errors for non-ASCII characters, whatever the parent encoding is. An example of this is ©.

See https://github.com/ruby/net-http/issues/14 for a root cause analysis of the Adapter

2023-06-28 11:21:10 - INFO - Automation Helpers - Patch successfully added.

0 scenarios 0 steps 0m0.000s```

luke
2023-06-28 03:22:13

*Thread Reply:* [11:21:10] luke@luke-ubuntu:~/Code/exordo-app-automation$ echo $? 0

luke
2023-06-28 03:23:09

*Thread Reply:* This would fall into the "not-cucumber" pot. If you want to fail based on the number of scenarios ran, that's fine. But it's not something that should be happening by the design of cucumber.

luke
2023-06-28 03:23:54

*Thread Reply:* note that this is different to "failing to run scenarios".

luke
2023-06-28 03:24:28

*Thread Reply:* ```# env.rb

frozenstringliteral: true

require 'dotenv' Dotenv.load('.env')

yapowwwww```

luke
2023-06-28 03:24:46

*Thread Reply:* cucumber -t @abc undefined local variable or method `yapowwwww' for main:Object (NameError) /home/luke/Code/exordo-app-automation/features/support/env.rb:6:in `&lt;top (required)&gt;' &lt;internal:/usr/share/rvm/rubies/ruby-3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb&gt;:37:in `require' &lt;internal:/usr/share/rvm/rubies/ruby-3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb&gt;:37:in `require' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `load_code_file' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:145:in `load_file' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `each' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:274:in `load_step_definitions' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:74:in `run!' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb:29:in `execute!' /usr/share/rvm/gems/ruby-3.2.1/gems/cucumber-8.0.0/bin/cucumber:9:in `&lt;top (required)&gt;' /usr/share/rvm/gems/ruby-3.2.1/bin/cucumber:25:in `load' /usr/share/rvm/gems/ruby-3.2.1/bin/cucumber:25:in `&lt;main&gt;' /usr/share/rvm/gems/ruby-3.2.1/bin/ruby_executable_hooks:22:in `eval' /usr/share/rvm/gems/ruby-3.2.1/bin/ruby_executable_hooks:22:in `&lt;main&gt;'

luke
2023-06-28 03:24:57

*Thread Reply:* [11:24:32] luke@luke-ubuntu:~/Code/exordo-app-automation$ echo $? 2

luke
2023-06-28 03:26:10

*Thread Reply:* Hopefully that clarifies everything for you 😄 But yeh if you want to write some shell wrapper that queries the amount of ran scenarios, that's all well and good. There is a gem called cuke_modeler that will give you those stats. maybe something similar exists in JS or can be written readily?

Eliav Ran
2023-06-28 04:36:37

*Thread Reply:* that is what i see when running the tests

Eliav Ran
2023-06-28 04:38:49

*Thread Reply:* @luke In normal circumstances, I expect it to behave as it is currently doing. However, if I pass the appropriate flag, I would prefer it would fail fail.

luke
2023-06-28 05:18:13

*Thread Reply:* what is the exit code from that command? I would expect it to be exiting with 0.

Eliav Ran
2023-06-28 07:04:19

*Thread Reply:* Its 0 even though nothing was running 😮‍💨

luke
2023-06-28 07:40:29

*Thread Reply:* that tells you it's fine then.

Eliav Ran
2023-06-28 07:56:24

*Thread Reply:* But it actually failed becuse nothing ran even though It should have about 50 test runing

Michael Morris
2023-06-28 10:51:31

*Thread Reply:* @luke What I meant was adding a CLI arg cucumber-js --expected-scenarios 20 If the number of passes doesn't match the argument, exit code 1. And yeah, you can do this with a wrapper but it isn't straight forward.

Eliav Ran
2023-06-28 10:54:05

*Thread Reply:* @Michael Morris i think the better solution for me is --minimum-tests 1

Michael Morris
2023-06-28 11:04:39

*Thread Reply:* Maybe just --expect-tests and if that flag is present fail if nothing runs.

Aleksandar KIRILOV
2023-06-28 22:33:51

*Thread Reply:* Hello I have opened an issue "feature request" in cucumber github

https://github.com/cucumber/cucumber-js/issues/2296

Eliav Ran
2023-06-28 22:42:52

*Thread Reply:* @Aleksandar KIRILOV amazing, thank you...

❤️ Aleksandar KIRILOV
luke
2023-06-29 01:45:26

*Thread Reply:* @Michael Morris I understand what you meant, but I've said several times now this isn't something that should be determined by cucumber.

Eliav Ran
2023-06-29 02:09:22

*Thread Reply:* Its a flag You dont have to use it

Aleksandar KIRILOV
2023-06-29 03:05:51

*Thread Reply:* yes @luke let us have our flag 🤭 🏴‍☠️

plocket
2023-06-28 14:58:01

I tried to do the following: ```Background: @tag Examples: | a | b | | c | d | | e | f |

Scenario: a scenario Given <a> and <b>``` I got parsing errors. Is there another way to create the same examples for multiple scenarios? An answer in the thread would be great.

Matthias Carell
2023-06-29 01:16:12

*Thread Reply:* Background steps are added to all scenarios in the same feature. So the tag would apply to all scenarios. Therefore I don’t think it would make sense to have tags in the background section. Regarding the outline / examples tables I don’t think this is available on feature level. As discussed in the thread before you might be wetter with the setting the language in the configuration and run tests with one configuration per language.

luke
2023-06-29 01:46:43

*Thread Reply:* the parser error will tell you the problem, likely here an invalid keyword

plocket
2023-06-29 05:32:44

*Thread Reply:* Thanks for the input. I’ve tried with the configuration, but I can’t get it to do what I want. What the users want to be able to do:

• By default, only the default language will be run. • Users would be able to manually trigger running the same separate individual tests for each of multiple languages. • Users would be able to manually trigger just one language. I’m not sure how to achieve the second of those objectives using the configuration file since without Examples, a Scenario can only be triggered once. Any ideas?

luke
2023-06-29 05:33:30

*Thread Reply:* If you want to dynamically (but not at runtime), configure the tests to be ran multiple times, that's not something you "should" do with cucumber or any testing framework, as it breaks TIL.

luke
2023-06-29 05:33:48

*Thread Reply:* the way in which you should do that is using outlines

luke
2023-06-29 05:34:17

*Thread Reply:* you should design it as I mentioned, using i18n, and passing the key in as an env var

luke
2023-06-29 05:34:43

*Thread Reply:* you can then also (in your env), do something like

ENV.fetch('LANG, 'en')

luke
2023-06-29 05:34:52

*Thread Reply:* so you don't need to pass in a language, it'll just default to en

plocket
2023-06-29 05:38:45

*Thread Reply:* I can’t find the definition for TIL, but I think I understand what you mean by it - no default repeated input or something like that. Doesn’t that mean Background breaks TIL, though? Isn’t that for Steps and such that are supposed to be repeatable for all tests in a Feature?

luke
2023-06-29 05:39:10

*Thread Reply:* Sorry TIL or TIP is test isolation law/principle. which states tests should be independent.

luke
2023-06-29 05:39:30

*Thread Reply:* you shouldnt have 1 test that does 2 things, it should be 2 tests.

luke
2023-06-29 05:39:56

*Thread Reply:* background and examples are just examples of DRYing, they don't repeat things inside a single test.

luke
2023-06-29 05:40:32

*Thread Reply:* Just simply do something like I said earlier

Feature: Language test Scenario: Welcome message Given I am on the homepage Then I am welcomed home

plocket
2023-06-29 05:41:20

*Thread Reply:* Are Examples not TIL?

luke
2023-06-29 05:41:36

*Thread Reply:* again, theyre not intra-test. so no they don't break it.

plocket
2023-06-29 05:42:42

*Thread Reply:* Then why is using the same Examples for every test TIL? Sorry, trying to understand the differentiation. And maybe I haven’t described my use case very well.

luke
2023-06-29 05:43:03

*Thread Reply:* I'm not sure what you're complaining about. Like what is the issue.

luke
2023-06-29 05:43:25

*Thread Reply:* i've told you the two ways you should architect the thing. Until you go away and build one of those two options, try not to focus on complaints.

plocket
2023-06-29 06:06:41

*Thread Reply:* Sorry, not trying to complain, just to understand and develop. I’ve tried the configuration methods, but they don’t fulfill the requirements. Maybe I’m doing that wrong, but if so I haven’t yet understood the right way to do it. If so, I apologize if I’m missing something that seems obvious. I’m not sure how else to describe my issue, though, but I’ll try again:

  1. I have no control over how translations are done. The platform is a third party platform. Most of the users of the platform are pro bono and trying to help people who really need the help. The whole point of my testing framework is to allow people using that third party platform to run end-to-end tests. I can’t affect how the platform handles translations and I still want to help people who are struggling to file restraining orders and such and help them be safe.
  2. The tests are language agnostic - users are not testing anything about the text the humans see. Unfortunately, one of the ways to handle translations in that platform [which most users use] is to make .xlsx files that translate whole blocks of YAML code. The blocks of code contain the strings end users see, but they also contain code. Sometimes translators accidentally translate the code and break things. That is, the human language isn’t the only thing that’s affected. Here is a new improved description of the method of translation. Look at the last YAML block and the last row in the spreadsheet. That shows how code can be part of the text the translators edit.
  3. Users want to be able to test that the translators didn’t break anything, so after they get the code translated, they want to rerun the same exact tests, but now using the different translations.
  4. The tests are exactly the same, so rewriting them is complete duplication, which is also important to avoid. Sometimes people are translating 5 languages. If they had 10 tests (which I’d hope they’d have more), writing a different test for each language would mean 50 tests to maintain.
  5. The users want to usually test just the default language because running tests in all languages every time will make the tests take n times longer, where n is the number of languages they’re translating. [In some cases, that can take hours.] Just after translation, the uses want to be able to test multiple translations in one go or a single language at a time. They want to run them as separate tests so they can isolate which translation has a mistake in it. Does that help at all? Sorry if I’ve repeated stuff you’re already clear on, I’m just not understanding how the given configuration methods can help fulfill the requirements I’m describing.
plocket
2023-06-29 06:18:17

*Thread Reply:* From what I can tell, using the configuration methods described, I can allow users to test one language per test run. Because of Reasons that are equally as frustrating, if not more frustrating, than the translation method, users would have to wait for each test suite to finish before triggering the next one as opposed to just triggering them all at once. It’s a lot of babysitting for 5+ languages. If I have to, I’ll make users do that, but that’s not the ideal choice.

luke
2023-06-29 06:18:58

*Thread Reply:* Parallelism / sharding

plocket
2023-06-29 06:23:02

*Thread Reply:* Again, because of the Reasons, users will have to run each set of language tests in series if they’re running them using the configuration method. Or at least, I can’t see a way to avoid it. When the users are running the tests in GitHub, each time the action runs, the tests have to run their setup. Each time the tests run their set up, no other tests can be running at the same time.

plocket
2023-06-29 06:23:36

*Thread Reply:* Maybe there’s something I’m not understanding about how to use the configuration and still avoid that.

luke
2023-06-29 06:24:11

*Thread Reply:* I’m lost now. Just speak to your QA lead or something and have them figure this out. I’ve literally given you most of the solution

plocket
2023-06-29 06:25:12

*Thread Reply:* I’m the whole development team. Sorry to have frustrated you. Just so I understand, do you feel the configuration methods cover the requirements? Have I missed how the configuration methods work?

luke
2023-06-29 06:26:05

*Thread Reply:* I’ve given you both options for solving the prob using a translation file. And if you need to be verbose you already have the soln

plocket
2023-06-29 06:26:05

*Thread Reply:* Maybe if I explain what I’ve understood about the configuration methods.

plocket
2023-06-29 06:27:10

*Thread Reply:* User sets an env var to the language. LANG=es. They run the tests once with that language. They then set the env var to a different language. LANG=nb. They run the tests again with the new language. Is that correct?

luke
2023-06-29 06:27:34

*Thread Reply:* Yeh. But you could chain it.

luke
2023-06-29 06:27:51

*Thread Reply:* How they set it is irrelevant. Just that it is set using an env key.

plocket
2023-06-29 06:27:51

*Thread Reply:* That would be great! How could I chain it?

luke
2023-06-29 06:28:35

*Thread Reply:* Write a shell loop or pass in a bar that is comma separated and unchain it

plocket
2023-06-29 06:30:51

*Thread Reply:* Wow, loop in the shell instead. That could work I think. I can at least try it. I’m not sure what a bar is, but I don’t think I should unchain it (right?), so I probably want to skip that option anyway. Anyway, I can look up a bar.

plocket
2023-06-29 06:31:32

*Thread Reply:* Time to get to know bash a bit better!

luke
2023-06-29 06:34:58

*Thread Reply:* so something like

LANG=en,es,nb ./loop_cucumber.sh

luke
2023-06-29 06:35:20

*Thread Reply:* then ```# loop_cucumber.sh

languages=$(echo $LANG | tr "," "\n")

for locale in $languages do LANG=locale cucumber done```

:gratitude_thank_you: plocket
plocket
2023-06-28 15:10:59

If the config has tags defined and the cli also uses tags, what tags does cucumberjs use? Use the thread to answer if you can.

furiel
2023-06-29 00:46:36

@furiel has joined the channel

Tony Luisi
2023-07-02 16:15:08

@Tony Luisi has joined the channel

Tony Luisi
2023-07-02 16:20:00

Hi there,

I'm running cucumber js (with playwright) on a relatively slow machine (which I can't change). When we run the testing, it runs for a few minutes without any output and then right at the end spits out the output / results of testing. This can take over 4 minutes sometimes. Is there a way to print / output whats happening as the testing is proceeding. perhaps a verbose output of the steps being performed? or am I perhaps approaching this the wrong way?

David Goss
2023-07-02 22:44:16

*Thread Reply:* You might consider giving the pretty formatter a try https://github.com/cucumber/cucumber-js-pretty-formatter

Website
<https://cucumber.io/>
Stars
10
Tony Luisi
2023-07-03 16:24:40

*Thread Reply:* Cool I'll give that a go

Tony Luisi
2023-07-03 16:28:07

*Thread Reply:* That worked a treat, exactly what I needed 🙂

👍 David Goss
Michael Morris
2023-07-06 16:09:48

After 7 months I'm still without work. Does anyone know of a company that could use someone familiar with cucumber-js and related technologies?

Vikram Bhuskute
2023-07-10 03:14:04

@Vikram Bhuskute has joined the channel

Vikram Bhuskute
2023-07-10 03:14:27

Hello There,

Vikram Bhuskute
2023-07-10 03:15:06

I am new to cucumber and NodeJs both...Trying to understand how the cucumber test flow works

Vikram Bhuskute
2023-07-10 03:16:10

any link which explain how the cucumber workflow happens ? Any article/video on how excalty the cucumber thing works ?

Aleksandar KIRILOV
2023-07-10 05:31:42

*Thread Reply:* I am not sure if I understand correctly the answer but if you want to know how cucumber(js) works you should look at source code.

A good start might be in cli.run() function

https://github.com/cucumber/cucumber-js/blob/main/src/cli/index.ts#L41

Also the gherkin language's model diagram will help you understand how things work

David Goss
2023-07-10 11:08:47

*Thread Reply:* We could go really deep on this.

What problem are you trying to solve?

Vikram Bhuskute
2023-07-11 02:27:38

*Thread Reply:* Thank you so much for the help

Vikram Bhuskute
2023-07-11 02:27:55

*Thread Reply:* I was looking for connection between feature files and the step.js files...

plocket
2023-07-11 04:22:40

*Thread Reply:* In this section of the intro docs, it describes how to get started. It gives an example of code in steps.js. The feature files use the sentences that you create in your steps.js.

Vikram Bhuskute
2023-07-12 02:29:50

*Thread Reply:* Thanks for the pointer !

Vikram Bhuskute
2023-07-10 03:30:42

Another question - where should I enable DEBUG=cucumber so that I can see debug log getting printed ?

David Goss
2023-07-10 11:08:17

*Thread Reply:* Set the environment variable in your shell.

Vikram Bhuskute
2023-07-11 02:34:03

Thanks @Aleksandar KIRILOV !

Vikram Bhuskute
2023-07-11 02:34:52

I am also confused with configure file formst - cucumber.js

Terence Tian
2023-07-11 17:05:34

Hi, guys, while using cucumber.js parallel workers, is there a way to assign different custom environment variables to different workers. i.e. I need to assign different BASE_URL env vars to different parallel workers

Aleksandar KIRILOV
2023-07-12 00:50:12

*Thread Reply:* Hello @Terence Tian, there is a variable called CUCUMBERWORKERID that is set to 0, 1, 2 etc helping you distinguish your workers.

From thereon my advice would be to have different .env (ex: .env.0, env.1) files for each worker that has a set of different URLs and other needed configs.

You can load your dotenvs with something like: require('dotenv').config({ path: `.env.${process.env.CUCUMBER_WORKER_ID}` }) https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md

Terence Tian
2023-07-13 16:27:59

*Thread Reply:* @Aleksandar KIRILOV thanks for the advice, I end up using spawn in child_process to distribute work and env variables to different workers to run cucumber.js command

Vikram Bhuskute
2023-07-19 22:29:30

Hello, I have two queries 1) I am trying to enable debug logs but DEBUG=cucumber is not working. Please suggest If any other method. 2) How to run selective test cases ? like out of 5 feature file I want to run only first two

plocket
2023-08-03 08:24:07

*Thread Reply:* For item 2, I think you can use tags on feature files and use tag expressions to only test those features.

David Goss
2023-08-03 11:56:10

*Thread Reply:* What are you hoping to see with DEBUG=cucumber on?

David Goss
2023-08-03 11:57:03

*Thread Reply:* Re running a subset of scenarios, you have a few options including tags as mentioned above https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md

luke
2023-07-20 02:37:02

you can pass in files as a space separated list. @Vikram Bhuskute

Tim Yao
2023-08-02 19:02:52

A question about getting the cucumber.io published report URL. I see the published report URL is part of the pre-formatted message returned from the service. In https://github.com/cucumber/cucumber-js/blob/2fd424aa7127a6449291015ad326f555ed957203/src/publish/publish_plugin.ts#L30C6-L30C6 For some reason, I would like to send this URL to other CI tasks instead of letting it stay inside the console(which is hard to access). I can easily extract the URL from the pre-formatted message by using regex but how can I access the publish output? Can I get it from afterall hooks? I can patch the code or submit a PR if you like.

David Goss
2023-08-03 11:52:23

*Thread Reply:* There’s no way to capture the publish message unfortunately. Probably the best thing would be to direct stderr output to a file when you run, and then have another build step that parses it from that file.

David Goss
2023-08-03 11:53:25

*Thread Reply:* For context, the future of the Reports service is uncertain and we’re not currently making any changes around it. If you can get by with the html formatter (which has roughly the same outut) then I’d probably recommend that.

Tim Yao
2023-08-03 20:07:24

*Thread Reply:* emm, I understand the returned message is out of the control of cucumber-js. Looks like the only option is patch by myself and grab the url for now.

Tim Yao
2023-08-03 20:09:27

*Thread Reply:* The stderr output is too big which is hard to parse. and html formatter is what we are using but we are migrating to GitHub actions that doesn't have a good storage solution for it. Instead of setup my own file storage in cloud, I feel the cucumber.io report is simple.

Luciano James
2023-08-03 01:01:39

@Luciano James has joined the channel

Luciano James
2023-08-03 01:01:46

Hey, I'm trying to use cucumberJS in typescript and incorporate clet to test an interactive cli. When the module is added I get an error saying require() of ES module &lt;path&gt; is not supported, instead change the require of runner.js in &lt;path&gt; to a dynamic import() which is available in all CommonJS modules which suggests that I should be using import instead of require to import clet.runner but I am already using import in this case import { runner } from 'clet';. Any ideas on what the problem is here?

Stars
70
Language
JavaScript
David Goss
2023-08-03 11:54:30

*Thread Reply:* You might be using import syntax in your TypeScript, but when it’s compiled down to JavaScript by default it is transformed to require syntax. You can change this in your tsconfig.json in the compilerOptions though.

David Goss
2023-08-03 11:55:18

*Thread Reply:* Feel free to pop your config in here and I can sanity check. It’s somewhat tricky to get right, and the picture is complicated by the import vs require thing.

Luciano James
2023-08-04 01:16:02

*Thread Reply:* Ok thats probably the issue, here is the config { "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "allowJs": true, "esModuleInterop": true } }

David Goss
2023-08-04 06:40:28

*Thread Reply:* I meant your cucumber config, but yeah the ‘module’ option will need to change to something like ‘esnext’

plocket
2023-08-06 14:38:03

Is there a puppeteer Slack or Discord somewhere? Would it be inappropriate to ask puppeteer questions in here? I’ve gotten the impression that a fair number of people that use cucumber use puppeteer as well. An answer in a thread would be great.

Chandrika
2023-08-07 09:21:23

Hello I am trying to implementing API calls in the framework.

I am getting below error

Chandrika
2023-08-08 08:09:59

*Thread Reply:* Issue fixed with Process.env[NODETLSREJECT_UNAUTHORISED”]=0

plocket
2023-08-07 18:22:11

I’ve been running my tests successfully. I changed some code that doesn’t affect this test at all (I know, I know, but all the other 30+ tests are passing and the difference in this test definitely doesn’t have anything different in the Before) and suddenly a test is failing because of the Before(). The output is printing undefined right after the x Before. I moved the code in there into its own async function and called that in Before() with an await, but that hasn’t given me any more specific message or line numbers. I’ve wrapped the Before() in a try/catch, but it’s not catching anything. Here’s what I’m getting from the output: ```1) Scenario: My test # test.feature:line ✖ Before # steps.js:line undefined ✔ Given I start the test # steps.js:line ✔ And another step # steps.js:line ✔ And another step # steps.js:line ✔ And another step # steps.js:line ✔ After # steps.js:line

1 scenario (1 failed) 4 steps (4 passed) 0m17.605s (executing steps: 0m17.496s) /Users/repo/node_modules/indent-string/index.js:11 throw new TypeError( ^

TypeError: Expected input to be a string, got undefined at module.exports (/Users/repo/nodemodules/indent-string/index.js:11:9) at formatStep (/Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/helpers/testcaseattemptformatter.js:87:48) at /Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/helpers/testcaseattemptformatter.js:101:17 at Array.forEach (<anonymous>) at formatTestCaseAttempt (/Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/helpers/testcaseattemptformatter.js💯22) at formatIssue (/Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/helpers/issuehelpers.js:25:94) at /Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/summaryformatter.js:55:48 at Array.forEach (<anonymous>) at SummaryFormatter.logIssues (/Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/summaryformatter.js:54:16) at SummaryFormatter.logSummary (/Users/repo/nodemodules/@cucumber/cucumber/lib/formatter/summary_formatter.js:41:18)

Node.js v18.17.0``` How can I figure out what’s going on? An answer in a thread would be much appreciated.

David Goss
2023-08-08 11:26:56

*Thread Reply:* I replied on the GitHub issue for posterity.

plocket
2023-08-09 04:54:29

*Thread Reply:* Thank you, your reply was very helpful. [For the People of the Future, the problem was that I was trying to manipulate values in the callback argument in After() , scenario.result.status. Shouldn’t be doing that.]

plocket
2023-08-09 05:00:36

*Thread Reply:* Is it possible to manipulate the willBeRetried value in the options that are given to the After() callback, or should we avoid that too? It would be incredibly useful for us if we can choose dynamically whether to rerun the test or not.

David Goss
2023-08-09 05:57:12

*Thread Reply:* Same problem really, that should be immutable. I think finer-grained control of retries is an interesting use case though, feel free to raise an issue on there. It might be something we could look at with the new plugins concept.

🙌 plocket
plocket
2023-08-08 06:52:01

Also, is this a problem others have run into?

plocket
2023-08-09 04:56:12

What is the second argument to the After() hook callback? The docs are here: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/api_reference.md#afteroptions-fn. They say “When using the asynchronous callback interface, have one final argument for the callback function.” That doesn’t quite describe how cucumberjs will use last argument.

plocket
2023-08-09 05:48:25

*Thread Reply:* This comment in GitHub shows a function being handed in as an argument to which you can pass, among other things, the status of the test. Is that the second argument? What are the other arguments that are possible to hand in? Or is that an old API that doesn’t exist anymore? One example given: After((world, callback) =&gt; { callback(null, 'skipped'); });

David Goss
2023-08-09 06:01:29

*Thread Reply:* It’s tricky to understand, but the options object is optional. So your actual hook function could be the first or second arg to Before

David Goss
2023-08-09 06:01:58

*Thread Reply:* I need to double check in terms of arguments to the hook function.

plocket
2023-08-09 05:42:29

In the “Hooks” section of the documentation Before() has the option to have a name passed in. The reference documentation for Before() doesn’t show that. Which of those is correct?

David Goss
2023-08-09 05:59:52

*Thread Reply:* Fixed the doc just now, thanks for pointing out. It’s an optional prop on the options object on both Before and After

👍 plocket
Raja S
2023-08-10 09:41:35

@Raja S has joined the channel

plocket
2023-08-12 15:01:50

We’re writing a testing framework. We want to test that our failures fail in the right ways. If the fail in the right ways, we want the tests to pass. Any ideas on how to achieve this without manipulating the scenario results object?

David Goss
2023-08-14 06:00:30

*Thread Reply:* Consider using setDefinitionFunctionWrapper - you can catch the error that results from the step, then decide if you want to rethrow or swallow it https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/api_reference.md#setdefinitionfunctionwrapperwrapper

plocket
2023-08-14 06:38:13

*Thread Reply:* I’m not sure that’ll do what we want. We want to throw it initially - fail the Step - but catch it in After() - pass the Scenario.

plocket
2023-08-14 06:39:24

*Thread Reply:* Maybe I’m misunderstanding, though.

Tim Yao
2023-08-14 21:31:35

*Thread Reply:* I have a similar test, maybe it's not the best way but it works for me https://github.com/tim-yao/cucumber-nightwatch/blob/main/test/features/cucumber_nightwatch.feature

plocket
2023-08-17 04:34:27

*Thread Reply:* I haven’t been able to find where your code is that implements those steps, @Tim Yao, though thank you for the example and I’m very interested to see that.

plocket
2023-08-17 04:42:59

*Thread Reply:* Remember that I want the step to fail, but the scenario to pass. That means the failure has to happen in After()

plocket
2023-08-17 11:11:37

*Thread Reply:* Sorry, I mean After() has to swallow up the failure - make sure the Scenario as a whole passes.

Tim Yao
2023-08-18 01:55:52

*Thread Reply:* Step definition can be found in https://github.com/tim-yao/cucumber-nightwatch/blob/main/test/features/cucumber_nightwatch.steps.js

plocket
2023-08-20 13:10:26

*Thread Reply:* But I don’t want the failing step to pass. I want the failing step to fail. I then want the scenario to pass.

plocket
2023-08-20 13:11:30

*Thread Reply:* Thank you for pointing me to the code you were talking about, though. I think it just doesn’t achieve what I want to achieve.

Tim Yao
2023-08-22 02:34:16

*Thread Reply:* The code I posted is exactly what you asked for. But I think you didn't read the code though. The test is testing the failure of a sub-process of another cucumber test. If it gets the failed test result, then it passes. However, you have to read the code then you can understand. It's quite hard to explain all the details.

plocket
2023-09-19 08:22:43

*Thread Reply:* Wow, yeah, I didn’t understand the full context. I wasn’t really familiar with all of this stuff. Your clarification helped a lot, thank you.

Mahi
2023-08-15 21:29:05

@Mahi has joined the channel

Mahi
2023-08-15 21:31:38

Can anyone share the sample playwright-js with cucumber-js framework

Tim Yao
2023-08-18 01:54:19

*Thread Reply:* https://github.com/Tallyb/cucumber-playwright Have you tried this one?

Stars
277
Language
TypeScript
Tim Yao
2023-08-29 21:12:20

With junit formatter and cucumber-js v9.3.0, we recently saw the below error intermittent in the console report. Any idea? NaN scenarios 683 steps (8 failed, 63 skipped, 612 passed) 34m14.690s (executing steps: 48m28.393s) /app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:131 data.time = testStepResult.duration ^ TypeError: Cannot read properties of undefined (reading 'duration') at JunitFormatter.getTestStep (/app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:131:32) at /app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:101:19 at Array.map (&lt;anonymous&gt;) at JunitFormatter.getTestSteps (/app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:99:47) at /app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:221:28 at Array.map (&lt;anonymous&gt;) at JunitFormatter.onTestRunFinished (/app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:212:29) at EventEmitter.&lt;anonymous&gt; (/app/node_modules/@cucumber/cucumber/src/formatter/junit_formatter.ts:83:14) at EventEmitter.emit (node:events:525:35) at EventEmitter.emit (node:domain:489:12) I feel it may not related to junit though. The NaN scenarios was from default, right? And the html report is also broken.

Tim Yao
2023-08-29 21:27:17

*Thread Reply:* I did a comparison with a working HTML report. The broken HTML report stops at before the testRunFinished part. Without continue output the rest of the HTML.

Tim Yao
2023-08-29 22:20:23

*Thread Reply:* Another different formatter error we got yesterday, after all test run finished: /app/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77 objects.forEach((x) =&gt; (counts[x.status] += 1)) ^ TypeError: Cannot read properties of undefined (reading 'status') at /app/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77:36 at Array.forEach (&lt;anonymous&gt;) at getCountSummary (/app/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77:11) at formatSummary (/app/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:53:23) at PrettyFormatter.logSummary (/app/node_modules/@cucumber/cucumber/src/formatter/summary_formatter.ts:72:20) at EventEmitter.&lt;anonymous&gt; (/app/node_modules/@cucumber/cucumber/src/formatter/summary_formatter.ts:27:14) at EventEmitter.emit (node:events:525:35) at EventEmitter.emit (node:domain:489:12) at Coordinator.onWorkerProcessClose (/app/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:200:29) at ChildProcess.&lt;anonymous&gt; (/app/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:158:12)

Tim Yao
2023-08-29 22:23:08

*Thread Reply:* Both HTML reports stoped at before the testRunFinished part.

Raja S
2023-08-30 10:23:32

Hello, Have another issue. Any coding experts, please assist. I'm launching multiple browsers to run tests and I notice that all browser launch correctly but the tests only run on the last browser in the configuration. Here is the code. I can describe in detail if anyone wants to huddle. Thanks in advance.

to reiterate, there are 5 diff browser configuration i the browserConfigs, and all of them launch correctly, but the tests only show running the very last config ( in this case, iPhone12 ). THanks.

```const browserConfigs = [ { name: 'Desktop chromium', type: chromium, device: devices['Desktop Chrome'] }, { name: 'Desktop firefox', type: firefox, device: devices['Desktop Firefox'] }, { name: 'Desktop safari', type: webkit, device: devices['Desktop Safari'] }, { name: 'Mobile Chrome Pixel 5', type: chromium, device: devices['Pixel 5'] }, { name: 'Mobile Safari iPhone 12', type: webkit, device: devices['iPhone 12'] }, ];

// Create a new browser context and page per scenario Before(async function ({ pickle }) { console.log("BEFORE new browser")

for (const config of browserConfigs) {

  global.browser = await config.type.launch(options);

  let contextOptions = { ...config.device };

  global.context = await global.browser.newContext(contextOptions);
  global.page = await global.context.newPage();

  activeConfigs.push(config);
  console.log(config.name)

}

});```

Felipe Correa
2023-09-05 09:43:59

@Felipe Correa has joined the channel

Raja S
2023-09-05 13:35:34

Hello, does anyone know if there is a way to let the test scenario continue even if one of the step fails in the scenario ?

Aleksandar KIRILOV
2023-09-09 05:15:34

*Thread Reply:* Hello in my opinion if you need it to continue the these are two separate scenarios. Maybe you should split them into smaller ones

Gabriel Samadoulougou
2023-09-15 07:45:28

@Gabriel Samadoulougou has joined the channel

Gabriel Samadoulougou
2023-09-15 07:45:32

Hi .I am facing a really odd issue when trying to execute my cucumber js project in pipelines. Context : TS Project with Playwright + Cucumber JS - Target Web application Issue : • can run project locally no problem . Cucumber Js finds the support code and calls the hooks • when trying to run on bitbucket , cucumber hooks are not called --- no error whatsover What I have tried : • enabled cucumber debugging . ◦ The trail stops after the log : Found support files to load via import based on configuration: [] ( Note , when it works locally , after this log ..the cucumber hooks are called ) My question : • what can cause cucumber hooks to not be called ? ( from the output I can tell it sees the support code ) • why is it not happening when I run locally • Is there any further debugging possible ? • Anybody knows where in the cucumber lib I can check what should be called next

&gt; cucumber-js features/home-page/home.feature
Configuration will be loaded from "cucumber.mjs"
No profiles specified; using default profile
Resolved configuration: {
  backtrace: false,
  dryRun: false,
  forceExit: false,
  failFast: false,
  format: [
    'json:reports/cucumber-report.json',
    'html:reports/report.html',
    'summary',
    'progress-bar',
    '@cucumber/pretty-formatter'
  ],
  formatOptions: { snippetInterface: 'async-await' },
  import: [],
  language: 'en',
  name: [],
  order: 'defined',
  paths: [ 'features/home-page/home.feature' ],
  parallel: 0,
  publish: false,
  publishQuiet: true,
  require: [ 'src/****/**.ts' ],
  requireModule: [ 'ts-node/register' ],
  retry: 1,
  retryTagFilter: '',
  strict: true,
  tags: '',
  worldParameters: {}
}
Found feature files based on configuration: [ '/workspace/features/home-page/home.feature' ]
Found support files to load via `require` based on configuration: [

  '/workspace/src/support/hook.ts',

]
Found support files to load via `import` based on configuration: [
Gabriel Samadoulougou
2023-10-06 09:59:24

*Thread Reply:* Any input 😓

Jeff Pierce
2023-09-15 08:45:18

@Jeff Pierce has joined the channel

Vikram Bhuskute
2023-09-29 02:08:52

Hello All, I have a "Then" function with a timeout.... Then('The device will connect to network', { timeout: 15 * 60 * 1000 }, function () {..... inside that I need to periodically check status ....so I have used setInterval.(5 seconds).. for which the clearInterval() is done on certain condition... but when the cucumber timeout of 15 seconds occure,,,, ..the cearInterval() is not done ...so it keeps on coming back after 5 second ? Where to add clearInterval() which will be callled if timeout occurs

David Goss
2023-09-29 07:06:51

*Thread Reply:* You could set your interval id on the world (this) and then clear it from a AfterStep hook

David Goss
2023-09-29 07:08:18

*Thread Reply:* https://github.com/cucumber/compatibility-kit/blob/main/.github/workflows/release-ruby.yml#L36-L38

Vikram Bhuskute
2023-09-29 09:55:13

*Thread Reply:* ok thanks

Vikram Bhuskute
2023-09-29 02:09:14

I mean 15 minutes

Vikram Bhuskute
2023-10-04 04:40:19

Hello All, If I have to repat a failed scenario , how can I achieve.... can I put number of repeatition ?

David Goss
2023-10-04 09:36:26

*Thread Reply:* You can https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md

Vikram Bhuskute
2023-10-05 05:04:35

*Thread Reply:* thanks David

RomiVillaverde
2023-10-09 04:58:47

@RomiVillaverde has joined the channel

Brice.C
2023-10-12 09:07:37

@Brice.C has joined the channel

RomiVillaverde
2023-10-18 06:46:51

Hi everyone! I'm integrating Cucumber in an existing React app testing it with react-testing-library. It's working, but I'm having issues with some external libraries and I would like to know if anyone faced this kind of issue before and what you all can recommend to solve it. I'm searching about how I could mock libraries or React components but they all use Jest, is there a better approach for this or do you suggest go with Jest? (I was looking at the example provided in this comment).

Thank you all!

🤔 plocket
slackbot
2023-10-18 06:46:51

Salutations Earthling! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Sean Hagstrom
2023-10-20 10:17:59

@Sean Hagstrom has joined the channel

Usman
2023-10-24 11:36:08

@Usman has joined the channel

Jasur
2023-10-24 23:13:41

@Jasur has joined the channel

Jasur
2023-10-24 23:14:14

Hi all, could you please help with this?

Jasur (https://cucumberbdd.slack.com/team/U05UPQ6TRRS)
Jasur
2023-10-25 10:08:05

*Thread Reply:* Solution here: https://stackoverflow.com/questions/77356810/run-cucumber-by-tag-or-run-all-tests?noredirect=1#comment136374867_77356810

Stack Overflow
plocket
2023-10-27 13:30:22

*Thread Reply:* Weird. We don’t have a config, but way back when we messed with the package.json script our tags didn’t give us problems. I’m not the one that wrote that code, though.

Brice.C
2023-10-26 06:41:58

Hello, I’m new to the community, and I apologize in advance if this topic has already been addressed (I couldn’t find it in the history). We use cucumber-js for very low-level tests for our services. We are on a TS stack. We have a lot of scenarios that execute quickly (barely 500ms), but the loading time can take almost 2 minutes, whether we execute one or all scenarios. It’s not a huge issue, but it quickly becomes time-consuming during development. Do you have any advice or tips for reducing this loading time? Or perhaps at least a solution for monitoring what’s happening during loading? I haven’t found anything relevant while searching the web... For example, on one of our services: 53 scenarios (53 passed) 264 steps (264 passed) 0m00.338s (executing steps: 0m00.210s) Total executing time: 1m 36s Thanks in advance.

David Goss
2023-10-26 06:52:19

*Thread Reply:* That’s odd!

Do you have any expensive setup operations that run in a BeforeAll hook or somewhere else?

Brice.C
2023-10-27 00:47:41

*Thread Reply:* No particularly heavy pretreatment. We have beforeStep functions, but the execution time doesn’t seem to be affected. I feel that it’s more the compilation that takes time.

David Goss
2023-10-27 01:02:08

*Thread Reply:* Okay, it would be good to profile this to see where the time is going. I need a refresher on how best to do that in Node.js though!

Brice.C
2023-10-27 01:57:02

*Thread Reply:* It’s definitely related to compilation, when I run with the environment variable TS_NODE_TRANSPILE_ONLY=true (so no compilation) I have a total execution time of 9s! But we lose a little the interest of TS if we generalize this… I am very interested in having a view of what is happening in compilation, I have not found a solution yet.

David Goss
2023-11-11 01:00:50

*Thread Reply:* Ah interesting. Do you see that if you compile separately with tsc?

David Goss
2023-11-11 01:01:18

*Thread Reply:* For past projects I have set ts-node to transpile only but then added a build step in CI to compile with tsc as a compromise.

Mahi
2023-11-03 20:36:28

Without using cucumber runner, can run all the scenarios with playwright test runner

David Goss
2023-11-04 08:15:37

*Thread Reply:* I don’t think so unfortunately. Playwright would need a way to preprocess features into tests and it doesn’t have that as far as I can see.

For Cypress there is https://github.com/badeball/cypress-cucumber-preprocessor

Stars
1264
Language
TypeScript
Mahi
2023-11-04 08:30:19

*Thread Reply:* Thanks @David Goss for the information

👍 David Goss
Mahi
2023-11-04 08:33:29

Anyone help me Browserstack integration with Playwright using Typescript not Javascript

I have solution from browserstack with Js not Ts

https://github.com/browserstack/node-js-playwright-browserstack/tree/sdk

Jasur
2023-11-06 02:12:32

*Thread Reply:* Node.js executes JS code. Either you need to compile TS code into JS, or you need to use ts-node to execute TS code in runtime.

Tom Newby
2023-11-20 17:10:32

@Tom Newby has joined the channel

Pratap
2023-11-27 00:17:18

@Pratap has joined the channel

Pratap
2023-11-27 00:17:28

Hi Team i am facing an issue with cucumber hooks[i am using playwright with cucumber.js] i have defined the the playwright browser- context- page in cucumber before hook but this page object is not passing to .js file and not coming to steps file as well

I am thinking there is some setup i missing from cucumber hooks to regular playwright files

can some one help me here

plocket
2023-11-30 17:47:46

*Thread Reply:* I probably don’t know enough to help, but you probably need to link to your code for anyone to really try to understand what’s going on.

Jasur
2023-12-05 20:57:19

Hi everyone! I need help with passing a custom CLI argument to cucumber. package.json: "scripts": { "pretest": "npx ts-node src/utils/report/reportInit.ts", "test": "cucumber-js --config=configs/cucumber.cjs", "posttest": "npx ts-node src/utils/report/reporter.ts", }, I need to pass custom CLI argument and catch it in BeforeAll hook, then implement my solution. When I try this: npm run test --condition=true I am not getting condition=true string inside arguments array (process.argv): [ 'C:\\Program Files\\nodejs\\node.exe', 'C:\\Users\\Jasurbek\\Documents\\Projects\\core-regression-bdd\\node_modules\\@cucumber\\cucumber\\lib\\runtime\\parallel\\run_worker.js' ] Could you point me in the correct direction, please? #help <#C6QJ6N695|help-cucumber-js>

Tom Newby
2023-12-06 03:43:05

*Thread Reply:* try npm run test -- --condition=true

https://stackoverflow.com/a/14404223

Stack Overflow
🙌 Jasur
Jasur
2023-12-06 04:26:12

*Thread Reply:* Thanks!

Jasur
2023-12-06 04:33:42

Hi, I have a cucumber config: { formatOptions: { snippetInterface: 'async-await' }, paths: [ 'src/features/' ], dryRun: false, require: [ 'src/step_definitions/****/**.ts', 'hooks.ts' ], requireModule: [ 'ts-node/register' ], format: [ 'json:test-results/json-report.json', 'progress' ], parallel: 5, } Before and BeforeAll hooks are executing functions in it 5 times (once per browser). For example, I want to make a purchase before certain scenarios and those scenarios use that purchased product: Before({ tags: '@purchasing', name: 'Display (Image) Campaign purchasing' }, async function(){ await purchaseCampaign('CPM', 'image', 'advertiser'); }); When I am running tests, I see each browser is purchasing a campaign/product. A total of 5 products were purchased. How can I manage so that hook actions are executed sequentially (and only once), not parallelly?

David Goss
2023-12-06 04:55:15

*Thread Reply:* Before hooks are always executed once per scenario.

BeforeAll hooks are executed once per test run in serial mode, or once per worker in parallel mode. Since you have parallel: 5 this will mean 5 times in practise. You could use BeforeAll without parallel, or (better) you could make your purchaseCampaign function idempotent so when called a 2nd, 3rd time etc it will just no-op since the record is already created.

Jasur
2023-12-06 05:59:01

*Thread Reply:* @David Goss How can I use BeforeAll without parallel? I can only set timeout for BeforeAll. Are there other ways I am missing? The credentials from the AWS Parameter store are being retrieved 5 times. And the campaign was also purchased 5 times, but I need it to be purchased once. I'd appreciate your help.

David Goss
2023-12-06 06:08:40

*Thread Reply:* If you want the BeforeAll only run once, you need to not use parallel

luke
2023-12-07 06:56:30

*Thread Reply:* or as mentioned, have it do some sort of halting execution.

create unless already_created? so to speak

💯 David Goss
Jasur
2023-12-14 06:10:23

*Thread Reply:* Is there any way to make BeforeAll hook run once? Like, maybe some passing environment variables?

David Goss
2023-12-14 06:13:48

*Thread Reply:* Some environment variables get set by Cucumber on the worker processes, see https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md

So, you could do something like if (process.env.CUCUMBER_WORKER_ID === '0') to make your thing only run on the first worker.

But as noted previously, making your setup functions of a “create if not exists” nature will give you a better time in the long run.

Oleksandr Semenyuk
2023-12-13 11:49:45

@Oleksandr Semenyuk has joined the channel

plocket
2023-12-20 11:11:20

When a test fails, is there a way to save its failure (with some unique information that identifies that particular Scenario and attempt) in the After hook and then use this unique info in the Before hook to tell that it’s a retry of that same scenario?

Jasur
2023-12-22 03:46:56

*Thread Reply:* If you want to retry failed tests, you can take look at this part of documentation: https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md

plocket
2023-12-22 04:45:54

*Thread Reply:* I already retry failed tests. I want more information about the failed tests when a new test runs.

Jasur
2023-12-26 06:44:43

*Thread Reply:* You can create an object or an array. Then push the result of the scenario to that object or an array. Or you can also write results to json file so that you read it after runtime.

Jasur
2023-12-26 06:45:20

*Thread Reply:* Something like this...

plocket
2023-12-26 11:54:41

*Thread Reply:* Sorry if I’m off base here, but what part of that is the unique id for the Scenario that I’d be able to connect to a later attempt?

plocket
2023-12-26 11:55:48

*Thread Reply:* I need to be able to recognize in the retry that the current retry is connected to that specific failed scenario.

David Goss
2024-01-10 09:37:34

*Thread Reply:* You can’t do this at the moment. I am going to be re-looking at retry though with a view to making it a more generic extension point where you can plug in your own retry logic.

What kind of context would you want to pass from the failed attempt to the next attempt, out of interest?

plocket
2024-01-11 10:46:07

*Thread Reply:* Good question and hard to answer because I haven’t gotten to experiment with anything. In my specific instance, I’d want the random seed I’d created in that previous Scenario. To generalize that, maybe what I want is to be able to communicate between tests. I suppose I might be able to use the global scope for that. It would help with retries, but even in parallel tests, could see this kind of info being useful as input for all running tests. For example, I have one case where if one test with a specific tag fails, none of the other tests that have that tag should be run either because they’re all going to fail and it wastes a lot of time. Maybe these things really are something for me to handle in the global scope somehow. Is that possible? And does that global scope exist for parallel tests too? I have to admit I haven’t tried those yet.

If I were trying to brainstorm more generally, for retries specifically people might want the info from the scenario that failed. That might be enough for most people.

tishbc
2024-01-03 19:44:09

@tishbc has joined the channel

Purnachandra
2024-01-08 08:43:39

@Purnachandra has joined the channel

Ana G
2024-01-10 08:29:47

@Ana G has joined the channel

Ana G
2024-01-10 08:36:29

hello. I am new to Cucumber. I am trying to set it up in an React Typescript project in combination with Jest for rendering the components. Can someone please help me with the config? I cannot make .ts step_definitions files work, neither integrate it with Jest. Any response is appreciated. Thanks 😁

David Goss
2024-01-10 09:30:53

*Thread Reply:* Why do you want both Cucumber and Jest? They’re both test runners but you can only really use one of those at a time

David Goss
2024-01-10 09:38:42

*Thread Reply:* > in combination with Jest for rendering the components If you want the part that renders a React component, that’s not Jest doing that. It’s maybe testing-library with a JSDOM environment, or something similar. You should be able to use that within Cucumber step definitions.

🙌 Ana G
Alex
2024-01-12 06:08:40

@Alex has joined the channel

Jasur
2024-01-19 09:54:35

Hey, I need your help with skipping tests with certain tags, for example: @bug Here's a command to run test in package.json: cucumber-js --config=configs/cucumber.cjs --profile ci But tests run on docker on ci/cd pipeline: Attaching error log from docker. On, my terminal tags are being parsed just fine. Am I missing something? Is this a correct command to run all tests except with tag bug: cucumber-js --config=configs/cucumber.cjs --profile ci --tags "not @bug" ?

David Goss
2024-01-20 03:11:02

*Thread Reply:* In your docker compose command you have --build-arg TAGS="-- --tags "not @bug"" As your usage is enclosed in double quotes, you may need to escape the inner ones that wrap your tag expression.

Jasur
2024-02-19 06:09:42

*Thread Reply:* @David Goss Need your help here again. When I run tests by tag with this command locally it worked fine: cucumber-js --config=configs/cucumber.cjs --profile ci --tags "@3 and @4 and @5" But when I ran exactly the same command from Jenkins, it did not work. Tags are passed as arguments to docker. Docker image is created in Linux ec2 instance. I've been trying to solve this issue for more than a month already, but no luck. Could you enlighten me, please?

Jasur
2024-02-19 20:18:33

*Thread Reply:* Update: if tags are passed with comma without space between, the test run started but no tests were executed.

Jasur
2024-01-22 20:33:43

Hi everyone! I am using Cucumber version 10.3.1. I need to periodically clean up data the tests create during the run time. When I try to call the functions in the project from the terminal I get the error (pls see the attachment). Cucumber is not installed globally. I use it only for the project. How can I fix it? Thanks in advance!

David Goss
2024-01-23 03:04:35

*Thread Reply:* You see that error because your file is calling setDefaultTimeout, but you’re only supposed to do that when an actual test run is happening.

If you split out your cleanup functions into another file that doesn’t call any Cucumber functions, and then run that, you should be fine.

Jasur
2024-01-23 06:38:53

*Thread Reply:* The cleanup function is in another folder: Project folder: |-&gt; hook.ts // This is where setDefaultTimeout is. |-&gt; src |-&gt; utils |-&gt; clearData.ts clearData.ts has few imports but none of them are related to Cucumber (either step definitions or POMs). clearData.ts: ```import { AxiosError } from 'axios'; import { DashboardPayload } from '../payloads'; import { httpRequest } from './api/httprequest/httpsRequest'; import { ListOfCampaigns } from './interfaces'; import { RequestBuilder } from './api/httprequest/RequestBuilder'; import { logger } from './logger/logger';

export async function deleteDraftCampaigns() { const { url } = DashboardPayload.search.admin; const config = new RequestBuilder() .setUrl(url) .setMethod('GET') .setCookies('admin');

const { data: { data: listOfCampaigns } } = await httpRequest<ListOfCampaigns>(config); logger.info(Found ${listOfCampaigns.length} campaigns);

const filteredCampaigns = listOfCampaigns.filter(campaign => campaign.campaign_status === 'draft' && campaign.name.includes('Test Automation')); logger.info(${filteredCampaigns.length} campaigns selected for deletion);

if (filteredCampaigns.length > 0) { for (const campaign of filteredCampaigns) { const deleteRequest = new RequestBuilder() .setUrl(/api/campaign/${campaign.id}/delete) .setMethod('POST') .setCookies('admin');

  try {
    const { status } = await httpRequest(deleteRequest);
    <a href="http://logger.info">logger.info</a>(`Deleting campaign ${campaign.id}... status ${status}`);
  } catch (error) {
    const err = error as AxiosError;
    if (err.status! &gt;= 500) {
      <a href="http://logger.info">logger.info</a>(`Deleting campaign ${campaign.id}... status ${err.status}`);
    }
  }

}

} else { logger.info('No campaigns for deletion'); } }```

David Goss
2024-01-23 06:41:32

*Thread Reply:* The stack trace shows your hooks.ts file being executed

Jasur
2024-01-23 07:20:33

*Thread Reply:* I tried by commenting out setDefaultTimeout, the same result:

David Goss
2024-01-23 07:25:36

*Thread Reply:* Same applies to all cucumber functions, you see it has highlighted BeforeAll now

Jasur
2024-01-23 07:38:15

*Thread Reply:* Yes, I see. Fixed now. Thanks 🙂

David Goss
2024-01-23 07:42:41

*Thread Reply:* No worries!

luke
2024-01-23 08:01:16

*Thread Reply:* nice you're using mailosaur too. I'm a big fan 😄

Jasur
2024-01-30 07:50:07

Hi everyone! Could you help debug this issue, please? When I run a test by tag from Jenkins (on Linux ec2 instance) I have an issue with BeforeAll hook that was supposed to get credentials from the AWS Parameter Store and instantiate an object from ParameterStore class. Locally, it is working as it is expected. The full log from Jenkins is attached. I am confused about what's really causing the problem. Is it the usage of quotes in config formatter or BeforeAll hook isn't invoked when tag is passed? or anything else?

David Goss
2024-01-30 09:18:36

*Thread Reply:* The message re formatter notation is only a warning and isn’t related to the error you have below it. Seems like a hook or step issue.

Jasur
2024-01-31 01:33:55

*Thread Reply:* Thank you, David!

👍 David Goss
plocket
2024-02-10 07:17:20

In my Before step, I log the Scenario name, but it doesn’t work for the first Scenario. Why is that and how can I get it to work?

David Goss
2024-02-11 13:27:26

*Thread Reply:* When you say log, are you doing this.log (which emits a plain text attachment to formatters) or like console.log?

plocket
2024-02-11 13:43:02

*Thread Reply:* console.log. I didn’t know this.log was a thing. Also, console.log gets things to appear in the GitHub actions console [while the action is running].

plocket
2024-02-11 13:47:31

*Thread Reply:* I suspect console.log() is async. Despite that, it works well for all the Scenarios after the first one.

plocket
2024-02-13 11:41:45

*Thread Reply:* Does that help?

plocket
2024-02-17 15:22:54

*Thread Reply:* Any thoughts on where I could start digging?

David Goss
2024-02-17 23:07:18

*Thread Reply:* Let’s try and put together a minimal repro. Can you share the code from that Before hook?

plocket
2024-02-20 10:26:28

*Thread Reply:* Great idea, not sure why I didn’t think of it, though I’m not sure we can use my code for that. Maybe a fresh repo. These are the relevant lines.

plocket
2024-02-20 10:26:34

*Thread Reply:* Thanks for replying

plocket
2024-02-21 07:48:06

*Thread Reply:* Is there an example of, say, the simplest repo ever? With a github action to run the tests? If so, I could fork that and try to recreate there.

plocket
2024-02-11 05:01:28

Does cucumber.js log the test results asynchronously? I’ve added my own logs and in my GitHub action, some of the logs get cut off sometimes [including the final cucumber logs]. [There are more details in this GitHub community post]

Hrithik
2024-02-12 05:54:46

@Hrithik has joined the channel

plocket
2024-02-13 12:20:02

I’m having a puppeteer problem, but I’m not sure where else to look for help. I’m running cucumber and puppeteer in something called a “background action” on a server. Something is leaving behind headless chrome browsers, taking up a lot of server memory over time. I think sometimes the process gets interrupted in the middle and the browser doesn’t get a chance to close. Does someone have ideas about what I can do about this? I don’t want to automatically kill all browser processes in case the user has some of their own. Is there a way I can get and store the browser PID so that later I can close the right one(s)?

plocket
2024-02-13 12:27:33

*Thread Reply:* I found a stackoverflow suggesting to use try {...} catch () {...} finally { await browser.close() }, but I’m not sure how to do that with cucumber. Would I put this in the Before() function, where I first open the browser? Do I put it in the After() somehow? Would that even help?

Atul Jha
2024-02-14 10:08:29

@Atul Jha has joined the channel

Jasur
2024-02-15 03:59:11

Hi everyone! Is it possible to create/register new keywords in cucumber-js? Like IF, ELSE, BUT, etc?

David Goss
2024-02-15 05:25:51

*Thread Reply:* But you can use today in your feature files (works the same as And)

David Goss
2024-02-15 05:26:13

*Thread Reply:* If and Else would be control flow, that’s not something that will ever be added to the syntax

Jasur
2024-02-15 05:27:53

*Thread Reply:* what about other custom keywords? Is it possible to add/register them myself?

David Goss
2024-02-15 05:31:18

*Thread Reply:* No. What problem are you trying to solve?

Jasur
2024-02-15 06:36:50

*Thread Reply:* Just wanted to insert my custom keywords, if possible, to make scenarios look good.

luke
2024-02-15 23:58:30

*Thread Reply:* This sounds like connextra documenting that can be done in between feature and your first scenario invocation.

Here you can write any words you want. Maybe that will help ?

Jasur
2024-02-19 09:16:03

*Thread Reply:* @luke Could you provide examples, please?

luke
2024-02-19 09:16:23

*Thread Reply:* ```Feature: Eating cucumbers

It is well known that cucumbers count as one of your five a day but what people don't often think of is that a cucumber salad if made correctly can be very tasty

As a healthy eating enthusiast I want to provide a quick and easy way for people to see recipes for cucumbers So that I am able to encourage more people to cook and prepare meals with cucumbers And I am able to make more money selling my cookbooks.

Scenario: .......

Rule: Cucumbers can be grown in cold climates Scenario: ......```

✅ Jasur
Atul Jha
2024-02-25 09:56:56

Hi guys, I have created a data table with two fields portfolio title and artist fullname. On my step definitions file, I have implemented the same. However, the issue I am getting is that

porfolioTitle = Portfolio artistFullName = Dummy Artist New

Do you know why this is happening and how I can solve this?

Atul Jha
2024-02-25 10:14:16

*Thread Reply:* Additionally I noticed that if portfolioTitle has single word, then the application works well but if portfolioTitle has multiple words then I get the above error.

Steven Hunt
2024-03-01 17:14:57

*Thread Reply:* First, can you show us what the Scenario Outline itself looks like? Also, did you copy/paste anything into this Examples table any point? I've seen weird things like this happen before with zero-width spaces from webpages, you can't see them but they can cause real havoc. Maybe try deleting the whole Examples section and re-type it, then see if it still behaves the same way.

Atul Jha
2024-03-03 09:23:08

*Thread Reply:* Hi @Steven Hunt, Thank you for your help. I did copy paste it but from another example.

Right now, the only workaround I had was using a single word. This is the scenario. I tried retyping the whole scenario section but it wasn’t helpful.

Steven Hunt
2024-03-03 09:25:30

*Thread Reply:* I would recommend writing your step definition like this: "enters value in the respective field with {string} {string}" and then there would be double quotes around each parameter like this in your feature file:

Then enters value in the respective field with "<artistFullName0>" "<portfolioTitle>"

It's the step definition where your parsing is getting messed up.

Atul Jha
2024-03-03 09:31:22

*Thread Reply:* Thank You @Steven Hunt . I added double quotes and “{string}” in the step definition file as well and it worked.

🙌 Steven Hunt
Jasur
2024-04-09 09:56:25

*Thread Reply:* Quick tip here: You used examples, not data tables. Data table values are passed as a 2D array to the last parameter of the anonymous function of the step definition. Then I check the following data | First name | John | | Last name | Smith | Step definition: Then('I check the following data', function(dataTable) { const rows = dataTable.raw(); // [ ['First name', 'John'], ['Last name', 'Smith'] ] });

slackbot
2024-02-25 09:56:57

Salutations Earthling! "Guys" is easily replaced with the more gender-neutral "Folks" or "All". We'd appreciate if you tried to use that. Thanks!

Vikram Bhuskute
2024-03-06 22:17:37

Hi , need help to solve this problem while running the feature scenario

Attempt 4 failed: Error: Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish. (node:2685) UnhandledPromiseRejectionWarning: Error: Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.

Jasur
2024-04-09 09:48:25

*Thread Reply:* If you've async function that takes a screenshot or records a video and then attaches it, most likely it is the cause. I had a similar issue, and resolved it by adding setTimeout after async function.

ANIL KORKMAZ
2024-03-09 18:01:15

@ANIL KORKMAZ has joined the channel

Felipe Correa
2024-04-04 09:22:34

Has anyone successfully integrated CucumberJS with Qase. I know Qase has a reporter library that supports it https://github.com/qase-tms/qase-javascript/tree/master/qase-cucumberjs#readme but it seems to be broken

GitHub
Jasur
2024-04-09 10:00:38

Hi everyone! I need help with the cucumber configuration. I am using an Allure reporter and progress to print the progress of the test to the console. The issue is if I put the allure reporter on the 0th index of the format , cucumber doesn't pass info to the allure but prints on the console. If I put allure reporter on the 1st index, allure collects test data, and a report is generated but progress doesn't print on the console.

David Goss
2024-04-09 10:48:33

*Thread Reply:* From the allure-cucumber-js readme:

> If you want to retain default formatter add some dummy file as output: So you want to do something like: format: [ 'progress', [`file://{path.resolve(__dirname, 'allureReporter.cjs')}`, './dummy.txt'] ] This will direct progress output to the terminal, and then a no-op file will accept the allure output while it does its normal thing.

David Goss
2024-04-09 10:48:50

*Thread Reply:* (I’m not a user of allure so anything beyond this, you would need to consult that project.)

David Goss
2024-04-09 10:50:07

*Thread Reply:* Docs on how to specify formats in the config (which has changed a bit hence the nested array in my example there) https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md

Jennek
2024-04-17 12:11:06

@Jennek has joined the channel

Jasur
2024-04-24 00:39:56

Hey all! Is it possible to re-use certain scenarios as a step definition? For example: ```Scenario: Performs some group of actions When I do action 1 And I do action 2 And I do action 3 Then I check all actions are done

Scenario: Another test Given Performs some group of actions And I do action 4```

David Goss
2024-04-24 03:09:24

*Thread Reply:* No, but you might find Background useful https://cucumber.io/docs/gherkin/reference/#background

🙌 Jasur
👍:skin_tone_2: Rob Myers
Vikram Bhuskute
2024-04-24 21:57:00

Hello All, is there any known issue of cucumber-nodejs in running all feature files together vs running them individually ?

Because we are getting test failure if we run all together and not getting failure if we run them individually.

We have cucumber-nodjs running on linux on Rasberi pi which is using usbserial interface.

If we use "npm run test" to run compelte suite, randomly we are getting problem in usbserial communication. If we use "npm run fatures/xyz.feature then things go smoothly!

Are we missing anything here ? one more information is in beforehooks our library which needs the usbserial binds and in afterhooks it unbinds,

David Goss
2024-04-25 03:14:30

*Thread Reply:* Hard to say without more details, but usually this is a signal that your scenarios aren’t fully independent and are competing for a resource. It sounds like you have Before and After hooks to setup and teardown resources though which is the right pattern. Are you using the parallel mode?

Vikram Bhuskute
2024-04-25 05:48:16

*Thread Reply:* Thanks David. No we are not using the parallel mode.

David Goss
2024-04-25 05:49:44

*Thread Reply:* > one more information is in beforehooks our library which needs the usbserial binds and in afterhooks it unbinds Could this be causing an issue if you are binding and unbinding multiple times in a single process? You might consider using BeforeAll and AfterAll instead if it’s applicable

Vikram Bhuskute
2024-04-25 05:50:52

*Thread Reply:* ok sure thanks, we will check that

👍 David Goss
Atul Jha
2024-05-06 13:24:40

I am getting a webpack compilation error in Cucumber and Cypress. Anyone here that can help me ?

Atul Jha
2024-05-06 21:46:44

*Thread Reply:* Error: Webpack Compilation Error Module parse failed: Unexpected token (3:5) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See <https://webpack.js.org/concepts#loaders> | Feature: Analytics | Scenario: SingleDownload &gt; When the user is in A&amp;D page | Then perform single download at Watching.handle [as handler] (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-preprocessor/dist/index.js:212:23) at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Watching.js:303:9 at Hook.eval [as callAsync] (eval at create (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), &lt;anonymous&gt;:6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/Hook.js:18:14) at Watching._done (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Watching.js:299:28) at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Watching.js:213:21 at Compiler.emitRecords (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:919:5) at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Watching.js:191:22 at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:885:14 at Hook.eval [as callAsync] (eval at create (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), &lt;anonymous&gt;:6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/Hook.js:18:14) at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:882:27 at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/neo-async/async.js:2818:7 at done (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/neo-async/async.js:3522:9) at alreadyWritten (/Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:714:8) at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:802:19 at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/node_modules/graceful-fs/graceful-fs.js:123:16 at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/graceful-fs.js:123:16 at /Users/atul/Library/Caches/Cypress/13.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/graceful-fs.js:123:16 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

Atul Jha
2024-05-06 21:46:55

*Thread Reply:* This is what the error message looks like.

Atul Jha
2024-05-06 21:47:02

*Thread Reply:* Please help @Eder Hernandez

Jonas Amundsen
2024-07-05 06:54:22

*Thread Reply:* This means that you haven't configured webpack properly. I recommend looking at any of the webpack examples at https://github.com/badeball/cypress-cucumber-preprocessor/tree/master/examples

Philip Rozycki-Burn
2024-05-13 03:16:37

@Philip Rozycki-Burn has joined the channel

Jake Levirne
2024-05-14 12:36:29

@Jake Levirne has joined the channel

Brendan McLoughlin
2024-05-22 17:43:30

@Brendan McLoughlin has joined the channel

Filip Barszcz
2024-06-14 01:02:52

@Filip Barszcz has joined the channel

Jasur
2024-06-24 01:59:36

Hi everyone! I run 5 tests in parallel. There are 13 scenarios in the feature file. I want to run the last scenario (which is at the end of the feature file) to run only after other scenarios are run. How can I make it wait until other scenarios are finished running?

Jasur
2024-07-25 04:24:24

Hi everyone! I run 5 tests in parallel. At the beginning, test run in 5 different browsers, and then at some point test won't run parallelly, but only one test at a time is executed. Do you know why cucumber switches to executing tests one by one?

plocket
2024-08-09 15:10:49

*Thread Reply:* I wonder if it runs all the tests in one file together

mpkorstanje
2024-08-09 08:12:20

@mpkorstanje has joined the channel

mpkorstanje
2024-08-09 08:29:31

Are those the retries by any chance?

☝️ David Goss
Jasur
2024-08-09 09:45:48

*Thread Reply:* Most definitely not. There are retries tags on few scenarios only.

mpkorstanje
2024-08-09 08:29:42

Btw, you may want to ask your question on Discord instead.

kalyan
2024-08-10 02:36:40

@kalyan has joined the channel

mpkorstanje
2024-08-13 19:43:17

archived the channel